#pragma once

#include <type_traits>

namespace ugly
{
    template<typename T> constexpr const bool is_enum_flag = false;

    template<typename T = typename std::enable_if<is_enum_flag<T>, T>::type>
    class auto_bool
    {
    private:
        T val_;
    public:
        constexpr auto_bool(T val) : val_(val) {}
        constexpr operator T() const { return val_; }
        constexpr explicit operator bool() const
        {
            return static_cast<std::underlying_type_t<T>>(val_) != 0;
        }
    };

    template <typename T>
    std::enable_if_t<is_enum_flag<T>, auto_bool<T>> operator&(T lhs, T rhs)
    {
        return static_cast<T>(
            static_cast<typename std::underlying_type<T>::type>(lhs) &
            static_cast<typename std::underlying_type<T>::type>(rhs));
    }

    template <typename T>
    std::enable_if_t<is_enum_flag<T>, T> operator|(T lhs, T rhs)
    {
        return static_cast<T>(
            static_cast<typename std::underlying_type<T>::type>(lhs) |
            static_cast<typename std::underlying_type<T>::type>(rhs));
    }
}

#pragma once

#include <type_traits>

namespace ugly
{
    template<typename T> constexpr const bool is_enum_flag = false;

    template<typename T, typename = typename std::enable_if<is_enum_flag<T>>::type>
    class auto_bool
    {
    private:
        T val_;
    public:
        constexpr auto_bool(T val) : val_(val) {}
        constexpr operator T() const { return val_; }
        constexpr explicit operator bool() const
        {
            return static_cast<std::underlying_type_t<T>>(val_) != 0;
        }
    };

    template <typename T>
    std::enable_if_t<is_enum_flag<T>, auto_bool<T>> operator&(T lhs, T rhs)
    {
        return static_cast<T>(
            static_cast<typename std::underlying_type<T>::type>(lhs) &
            static_cast<typename std::underlying_type<T>::type>(rhs));
    }

    template <typename T>
    std::enable_if_t<is_enum_flag<T>, T> operator|(T lhs, T rhs)
    {
        return static_cast<T>(
            static_cast<typename std::underlying_type<T>::type>(lhs) |
            static_cast<typename std::underlying_type<T>::type>(rhs));
    }
}

Fix bad template SFINAE declaration

Fix bad template SFINAE declaration


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <limits.h>

/**
 * kill processes which access descendants of given directory
 */
int is_number(const char *s)
{
	size_t i, len = strlen(s);
	for (i = 0; i < len; i++) {
		if (!isdigit(s[i]))
			return 0;
	}
	return 1;
}

void kill_processes(const char *dir)
{
	DIR *par_pdir, *chl_pdir;
	struct dirent *par_pdent, *chl_pdent;
	char path[PATH_MAX];

	par_pdir = opendir("/proc");
	if (par_pdir == NULL) {
		perror("opendir");
		return;
	}

	/* using children of  /proc/pid/fd, find out processes which accesses
	 * given directory and kill thoses
	 */
	while (par_pdent = readdir(par_pdir)) {
		if (isdigit(par_pdent->d_name[0]) &&
			((par_pdent->d_type == DT_DIR) || (par_pdent->d_type == DT_UNKNOWN))) {
			snprintf(path, sizeof(path), "/proc/%s/fd", par_pdent->d_name);
			chi_pdir = opendir(path);
			if (chl_pdir == NULL) {
				if (errno != EACCES || errno != ENOENT)
					perror(opendir);
				continue;
			}

			while (chl_pdent = readdir(chl_pdir)) {
			}
		}
	}

}

int main(int argc, const char *argv[])
{
	kill_processes(argv[1]);
	return 0;
}

Kill processes which access descendants of given directory

Signed-off-by: Hyeoncheol Lee <38aaa2eac3dc574e617f8f2982b79e2233686085@gmail.com>


/*
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 * Copyright © 2009 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <hwloc.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    cpu_set = mytest_hwloc_cpuset_alloc();
    mytest_hwloc_topology_init(&topology);
    mytest_hwloc_topology_load(topology);
    depth = mytest_hwloc_topology_get_depth(topology);
    printf("Max depth: %u\n", depth);
    mytest_hwloc_topology_destroy(topology);
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

/*
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 * Copyright © 2009 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <hwloc.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: cpuset alloc\n");
    cpu_set = mytest_hwloc_cpuset_alloc();
    printf("*** Test 2: topology init\n");
    mytest_hwloc_topology_init(&topology);
    printf("*** Test 3: topology load\n");
    mytest_hwloc_topology_load(topology);
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: cpuset free\n");
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

Add some more print statements to this test, just to help
differentiate the output when debugging is enabled

git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@1752 4b44e086-7f34-40ce-a3bd-00e031736276


#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a;
	uint64_t b;
	uint64_t c;
	uint64_t d;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a = 0;
	uint64_t b = 0;
	uint64_t c = 0;
	uint64_t d = 0;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

Fix some GCC initialization warnings

Fix some GCC initialization warnings


/******************************************************************************
    GameState.h

  Game State Management

  Copyright (c) 2013 Jeffrey Carpenter

  Portions Copyright (c) 2013 Fielding Johnston

******************************************************************************/
#ifndef GAMEAPP_GAMESTATE_HEADERS
#define GAMEAPP_GAMESTATE_HEADERS

#include <iostream>
#include <string>

#include "SDL.h"

#include "SDLInput.h"

#include "gamelib.h"

{
  public:
    virtual ~GameState();

    virtual void Pause() = 0;
    virtual void Resume() = 0;

    virtual void Input ( void ) = 0;
    virtual void Update ( void ) = 0;
    virtual void Draw ( void ) = 0;

  private:
    // ...
};

#endif // GAMEAPP_GAMESTATE_HEADERS defined

/******************************************************************************
    GameState.h

  Game State Management

  Copyright (c) 2013 Jeffrey Carpenter

  Portions Copyright (c) 2013 Fielding Johnston

******************************************************************************/
#ifndef GAMEAPP_GAMESTATE_HEADERS
#define GAMEAPP_GAMESTATE_HEADERS

#include <iostream>
#include <string>

#include "SDL.h"

#include "SDLInput.h"

#include "gamelib.h"

{
  public:
    virtual ~GameState();

    virtual void Pause() = 0;
    virtual void Resume() = 0;

    virtual void HandleInput ( void ) = 0;
    virtual void Update ( void ) = 0;
    virtual void Draw ( void ) = 0;

  private:
    // ...
};

#endif // GAMEAPP_GAMESTATE_HEADERS defined

Rename of Input to HandleInput

Rename of Input to HandleInput


#define _BSD_SOURCE

#include <stdio.h>

#include <arpa/inet.h>
#include <netinet/ip.h>

#include "config.h"
#include "common.h"

void printpkt(void)
{
	struct ip *iphdr = (struct ip *) pkt;

	printf("ip.version=%d "
			"ip.ihl=%d "
			"ip.tos=%02x "
			"ip.length=%d "
			"ip.id=%d "
			"ip.flags=%d%c%c "
			"ip.offset=%d "
			"ip.ttl=%d "
			"ip.protocol=%d "
			"ip.checksum=%04x "
			"ip.src=%s ",
			iphdr->ip_v,
			iphdr->ip_hl,
			iphdr->ip_tos,
			iphdr->ip_len,
			iphdr->ip_id,
			iphdr->ip_off & IP_RF,
			flag('d', iphdr->ip_off & IP_DF),
			flag('m', iphdr->ip_off & IP_MF),
			iphdr->ip_off & IP_OFFMASK,
			iphdr->ip_ttl,
			iphdr->ip_p,
			iphdr->ip_sum,
			inet_ntoa(iphdr->ip_src));
	printf("ip.dst=%s ", inet_ntoa(iphdr->ip_dst));
	dumppkt(iphdr->ip_hl * 4);
}

#define _BSD_SOURCE

#include <stdio.h>

#include <arpa/inet.h>
#include <netinet/ip.h>

#include "config.h"
#include "common.h"

void printpkt(void)
{
	struct ip *iphdr = (struct ip *) pkt;

	printf("ip.version=%u "
			"ip.ihl=%u "
			"ip.tos=%02x "
			"ip.length=%u "
			"ip.id=%u "
			"ip.flags=%u%c%c "
			"ip.offset=%u "
			"ip.ttl=%u "
			"ip.protocol=%u "
			"ip.checksum=%04x "
			"ip.src=%s ",
			iphdr->ip_v,
			iphdr->ip_hl,
			iphdr->ip_tos,
			iphdr->ip_len,
			iphdr->ip_id,
			iphdr->ip_off & IP_RF,
			flag('d', iphdr->ip_off & IP_DF),
			flag('m', iphdr->ip_off & IP_MF),
			iphdr->ip_off & IP_OFFMASK,
			iphdr->ip_ttl,
			iphdr->ip_p,
			iphdr->ip_sum,
			inet_ntoa(iphdr->ip_src));
	printf("ip.dst=%s ", inet_ntoa(iphdr->ip_dst));
	dumppkt(iphdr->ip_hl * 4);
}

Change printf format %d -> %u

Change printf format %d -> %u


//
//  Wasm3 - high performance WebAssembly interpreter written in C.
//
//  Copyright © 2019 Steven Massey, Volodymyr Shymanskyy.
//  All rights reserved.
//

#include <stdint.h>
#include <stddef.h>

#include "wasm3.h"

#define FATAL(...) __builtin_trap()

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
    M3Result result = m3Err_none;

    if (size < 8 || size > 256*1024) {
        return 0;
    }

    IM3Environment env = m3_NewEnvironment ();
    if (env) {
        IM3Runtime runtime = m3_NewRuntime (env, 128, NULL);
        if (runtime) {
            IM3Module module = NULL;
            result = m3_ParseModule (env, &module, data, size);
            if (module) {
                result = m3_LoadModule (runtime, module);
                if (result == 0) {
                    IM3Function f = NULL;
                    result = m3_FindFunction (&f, runtime, "fib");
                    if (f) {
                        m3_CallV (f, 10);
                    }
                } else {
                    m3_FreeModule (module);
                }
            }

            m3_FreeRuntime(runtime);
        }
        m3_FreeEnvironment(env);
    }

    return 0;
}

//
//  Wasm3 - high performance WebAssembly interpreter written in C.
//
//  Copyright © 2019 Steven Massey, Volodymyr Shymanskyy.
//  All rights reserved.
//

#include <stdint.h>
#include <stddef.h>

#include "wasm3.h"

#define FATAL(...) __builtin_trap()

int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
    M3Result result = m3Err_none;

    if (size < 8 || size > 256*1024) {
        return 0;
    }

    IM3Environment env = m3_NewEnvironment ();
    if (env) {
        IM3Runtime runtime = m3_NewRuntime (env, 128, NULL);
        if (runtime) {
            IM3Module module = NULL;
            result = m3_ParseModule (env, &module, data, size);
            if (module) {
                result = m3_LoadModule (runtime, module);
                if (result == 0) {
                    IM3Function f = NULL;
                    result = m3_FindFunction (&f, runtime, "fib");
                    /* TODO:
                    if (f) {
                        m3_CallV (f, 10);
                    }*/
                } else {
                    m3_FreeModule (module);
                }
            }

            m3_FreeRuntime(runtime);
        }
        m3_FreeEnvironment(env);
    }

    return 0;
}

Disable function execution for now, to focus on parsing issues


#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QThread>
#include "easylogging++.h"

class MyThread : public QThread {
  Q_OBJECT
  public:
    MyThread(int id) : threadId(id) {}
  private:
    int threadId;

  protected:
    void run() {
      LINFO <<"Writing from a thread " << threadId;

      LVERBOSE(2) << "This is verbose level 2 logging from thread #" << threadId;

      // Following line will be logged only once from second running thread (which every runs second into
      // this line because of interval 2)
      LWARNING_EVERY_N(2) << "This will be logged only once from thread who every reaches this line first. Currently running from thread #" << threadId;

      for (int i = 1; i <= 10; ++i) {
          LVERBOSE_EVERY_N(2, 3) << "Verbose level 3 log every two times. This is at " << i << " from thread #" << threadId;
      }

      // Following line will be logged once with every thread because of interval 1
      LINFO_EVERY_N(1) << "This interval log will be logged with every thread, this one is from thread #" << threadId;

      LINFO_IF(threadId == 2) << "This log is only for thread 2 and is ran by thread #" << threadId;

      std::vector<std::string> myLoggers;
      easyloggingpp::Loggers::getAllLogIdentifiers(myLoggers);
      for (unsigned int i = 0; i < myLoggers.size(); ++i) {
          std::cout << "Logger ID [" << myLoggers.at(i) << "]";
      }
      easyloggingpp::Configurations c;
      c.parseFromText("*ALL:\n\nFORMAT = %level");
    }
};
#endif

#ifndef MYTHREAD_H
#define MYTHREAD_H

#include <QThread>
#include "easylogging++.h"

class MyThread : public QThread {
  Q_OBJECT
  public:
    MyThread(int id) : threadId(id) {}
  private:
    int threadId;

  protected:
    void run() {
      LINFO <<"Writing from a thread " << threadId;

      LVERBOSE(2) << "This is verbose level 2 logging from thread #" << threadId;

      // Following line will be logged only once from second running thread (which every runs second into
      // this line because of interval 2)
      LWARNING_EVERY_N(2) << "This will be logged only once from thread who every reaches this line first. Currently running from thread #" << threadId;

      for (int i = 1; i <= 10; ++i) {
          LVERBOSE_EVERY_N(2, 3) << "Verbose level 3 log every two times. This is at " << i << " from thread #" << threadId;
      }

      // Following line will be logged once with every thread because of interval 1
      LINFO_EVERY_N(1) << "This interval log will be logged with every thread, this one is from thread #" << threadId;

      LINFO_IF(threadId == 2) << "This log is only for thread 2 and is ran by thread #" << threadId;

    }
};
#endif

Remove logger ids loop from sample

Remove logger ids loop from sample


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

#pragma once

#include <stddef.h>

#include "marker/unsafe.h"

namespace sus::mem::layout {

namespace __private {

template <class T>
struct layout_nonzero_tag final {
  static constexpr bool has_field(...) { return false; }
  static constexpr bool has_field(int)
    requires(std::is_same_v<
             decltype(std::declval<T>().SusUnsafeNonZeroIsNonZero()), bool>)
  {
    return true;
  };

  static constexpr bool is_non_zero(const T* t) {
    return t->SusUnsafeNonZeroIsNonZero();
  };
  static constexpr void set_zero(T* t) { t->SusUnsafeNonZeroSetZero(); };
};

}  // namespace __private

template <class T>
struct nonzero_field {
  static constexpr bool has_field =
      __private::layout_nonzero_tag<T>::has_field(0);

  static constexpr bool is_non_zero(::sus::marker::UnsafeFnMarker,
                                    const T* t) noexcept {
    return __private::layout_nonzero_tag<T>::is_non_zero(t);
  }
  static constexpr void set_zero(::sus::marker::UnsafeFnMarker, T* t) noexcept {
    __private::layout_nonzero_tag<T>::set_zero(t);
  }
};

}  // namespace sus::mem::layout

/// Mark a class field as never being zero (after a constructor has run, until
/// the destructor has completed).
#define sus_class_nonzero_field(unsafe_fn, T, name)                   \
  static_assert(std::is_same_v<decltype(unsafe_fn),                   \
                               const ::sus::marker::UnsafeFnMarker>); \
  template <class SusOuterClassTypeForNonZeroField>                   \
  friend struct ::sus::mem::layout::__private::layout_nonzero_tag;    \
  constexpr inline bool SusUnsafeNonZeroIsNonZero() const noexcept {  \
    static_assert(std::same_as<decltype(*this), const T&>);           \
    return static_cast<bool>(name);                                   \
  }                                                                   \
  constexpr inline void SusUnsafeNonZeroSetZero() noexcept {          \
    name = static_cast<decltype(name)>(0u);                           \
  }                                                                   \
  static_assert(true)

Add tools to mark a field as never-non-zero while constructed


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

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

        printf("Error, missing arguments\n");
        printf("Convention: \n");
        printf("./gpio_switch pin value\n");
        return EXIT_SUCCESS;

  }else{
        int valueFile;
        char refPath[256];
        sprintf(refPath, "/sys/class/gpio/gpio%s", argv[2]);
        char valuePath[256];
        sprintf(valuePath, "%s/value", refPath);

        if ((valueFile = open(valuePath)) < 0) {
            if (errno == ENOENT){
                int exportFile;
                if ((exportFile = open("/sys/class/gpio/export", O_WRONLY)) < 0){
                    return EXIT_FAILURE;
                }

                write(exportFile, argv[1], sizeof(argv[1]));
                close(exportFile);

                char directionPath[256];
                sprintf(directionPath, "%s/direction", refPath);
                int directionFile = open(directionPath, O_WRONLY);
                char* direction = "out";
                write(directionFile, direction, sizeof(direction));
                close(directionFile);

            }else{
                return EXIT_FAILURE;
            }
        }

        write(valuePath, argv[2], sizeof(argv[2]));
        close(valueFile);
  }
}

Add GPIO Switch first implementation

Add GPIO Switch first implementation


/**
 * \file   os_isfile.c
 * \brief  Returns true if the given file exists on the file system.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <sys/stat.h>
#include "premake.h"

int os_isfile(lua_State* L)
{
	const char* filename = luaL_checkstring(L, 1);
	lua_pushboolean(L, do_isfile(filename));
	return 1;
}

int do_isfile(const char* filename)
{
	struct stat buf;
	if (stat(filename, &buf) == 0)
	{
		return ((buf.st_mode & S_IFDIR) == 0);
	}
	else
	{
		return 0;
	}
}

/**
 * \file   os_isfile.c
 * \brief  Returns true if the given file exists on the file system.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <sys/stat.h>
#include "premake.h"

int os_isfile(lua_State* L)
{
	const char* filename = luaL_checkstring(L, 1);
	lua_pushboolean(L, do_isfile(filename));
	return 1;
}

int do_isfile(const char* filename)
{
	struct stat buf;
#if PLATFORM_WINDOWS
	DWORD attrib = GetFileAttributesA(filename);
	if (attrib != INVALID_FILE_ATTRIBUTES)
	{
		return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0;
	}
#else
	if (stat(filename, &buf) == 0)
	{
		return ((buf.st_mode & S_IFDIR) == 0);
	}
#endif

	return 0;
}

Fix do_isfile to support symbolic links on Windows.


// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.8.91"

#endif /*kmversion_h*/

// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.9.50"

#endif /*kmversion_h*/

Use a fresh version number for the trunk version

svn path=/trunk/KDE/kdepim/; revision=466318


#pragma once

#include <annis/types.h>
#include <annis/graphstorage/graphstorage.h>
#include <annis/db.h>
#include <annis/iterators.h>

namespace annis
{
  class Operator;

  /**
   * A join that checks all combinations of the left and right matches if their are connected.
   *
   * @param lhsIdx the column of the LHS tuple to join on
   * @param rhsIdx the column of the RHS tuple to join on
   */
  class NestedLoopJoin : public Iterator
  {
  public:
    NestedLoopJoin(std::shared_ptr<Operator> op,
      std::shared_ptr<Iterator> lhs, std::shared_ptr<Iterator> rhs,
      size_t lhsIdx, size_t rhsIdx,
      bool materializeInner=true,
      bool leftIsOuter=true);
    virtual ~NestedLoopJoin();

    virtual bool next(std::vector<Match>& tuple) override;
    virtual void reset() override;
  private:
    std::shared_ptr<Operator> op;

    const bool materializeInner;
    const bool leftIsOuter;
    bool initialized;

    std::vector<Match> matchOuter;
    std::vector<Match> matchInner;

    std::shared_ptr<Iterator> outer;
    std::shared_ptr<Iterator> inner;

    const size_t outerIdx;
    const size_t innerIdx;

    bool firstOuterFinished;
    std::list<std::vector<Match>> innerCache;
    std::list<std::vector<Match>>::const_iterator itInnerCache;
  private:
    bool fetchNextInner();

  };

} // end namespace annis

#pragma once

#include <annis/types.h>
#include <annis/graphstorage/graphstorage.h>
#include <annis/db.h>
#include <annis/iterators.h>
#include <deque>

namespace annis
{
  class Operator;

  /**
   * A join that checks all combinations of the left and right matches if their are connected.
   *
   * @param lhsIdx the column of the LHS tuple to join on
   * @param rhsIdx the column of the RHS tuple to join on
   */
  class NestedLoopJoin : public Iterator
  {
  public:
    NestedLoopJoin(std::shared_ptr<Operator> op,
      std::shared_ptr<Iterator> lhs, std::shared_ptr<Iterator> rhs,
      size_t lhsIdx, size_t rhsIdx,
      bool materializeInner=true,
      bool leftIsOuter=true);
    virtual ~NestedLoopJoin();

    virtual bool next(std::vector<Match>& tuple) override;
    virtual void reset() override;
  private:
    std::shared_ptr<Operator> op;

    const bool materializeInner;
    const bool leftIsOuter;
    bool initialized;

    std::vector<Match> matchOuter;
    std::vector<Match> matchInner;

    std::shared_ptr<Iterator> outer;
    std::shared_ptr<Iterator> inner;

    const size_t outerIdx;
    const size_t innerIdx;

    bool firstOuterFinished;
    std::deque<std::vector<Match>> innerCache;
    std::deque<std::vector<Match>>::const_iterator itInnerCache;
  private:
    bool fetchNextInner();

  };

} // end namespace annis

Use a deque instead of a list as inner cache in nested loop.


// PARAM: --enable ana.int.def_exc --enable ana.int.interval --enable ana.sv-comp.functions --set sem.int.signed_overflow assume_none --set ana.int.refinement never
// used to crash in branch when is_bool returned true, but to_bool returned None on (0,[1,1])
// manually minimized from sv-benchmarks/c/recursive/MultCommutative-2.c
extern int __VERIFIER_nondet_int(void);

void f(int m) {
    if (m < 0) {
        f(-m);
    }
    if (m == 0) {
        return;
    }
    f(m - 1);
}

int main() {
    int m = __VERIFIER_nondet_int();
    if (m < 0 || m > 1) {
        return 0;
    }
    f(m); // m=[0,1]
    return 0;
}

Add test with inconsistent IntDomain crash


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

#include "eventloop.h"
#include "timer.h"

int cjet_timer_init(struct cjet_timer *timer, struct eventloop *loop)
{
	return 0;
}

void cjet_timer_destroy(struct cjet_timer *timer)
{

}

Add stub for windows timer implementation.


#ifndef PATHFINDER_H_DEF
#define PATHFINDER_H_DEF

#include "pathfinder/mathutil.h"
#include "pathfinder/structs.h"

#include "pathfinder/fit.h"
#include "pathfinder/spline.h"
#include "pathfinder/trajectory.h"

#include "pathfinder/modifiers/tank.h"
#include "pathfinder/modifiers/swerve.h"

#include "pathfinder/followers/encoder.h"
#include "pathfinder/followers/distance.h"

#include "pathfinder/io.h"

#endif

#ifndef PATHFINDER_H_DEF
#define PATHFINDER_H_DEF

#ifdef __cplusplus
extern "C" {
#endif

#include "pathfinder/mathutil.h"
#include "pathfinder/structs.h"

#include "pathfinder/fit.h"
#include "pathfinder/spline.h"
#include "pathfinder/trajectory.h"

#include "pathfinder/modifiers/tank.h"
#include "pathfinder/modifiers/swerve.h"

#include "pathfinder/followers/encoder.h"
#include "pathfinder/followers/distance.h"

#include "pathfinder/io.h"

#ifdef __cplusplus
}
#endif

#endif

Use extern C if C++

Use extern C if C++


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

void foo() {
  assert(1);
}

void bar() {
  assert(1);
}

void (*funs[2])() = {
  &foo,
  &bar
};

extern void magic1();
extern void magic2(void (*funs[])());

void *t_fun(void *arg) {
  // just for going to multithreaded mode
  return NULL;
}

int main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL); // enter multithreaded mode

  magic1(); // invalidate funs a bit
  magic2(funs);
  return 0;
}

Add regression test where known functions in unknown AD should be spawned


// PARAM: --enable ana.int.interval
#include <assert.h>

int main() {
  unsigned long x;
  x = 0;

  int b;
  b = x == 7; // NOWARN

  if (b)
    assert(0); // NOWARN (unreachable)
  else
    assert(1); // reachable

  return 0;
}

Add unsigned eq emits spurious underflow warning


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

void makeNode(struct linkList **head, struct linkList **tail, int dat)
{
                struct linkList *curr;
                curr = (struct linkList*)malloc(sizeof(struct linkList));
                curr->data = dat;
                curr->next = NULL;

                if(*head == NULL)
                        *head = *tail = curr;
                else {
                        (*tail)->next = curr;
                        *tail = curr;
                }

}

void
main() {

        int dat;
        struct linkList *head, *tail;

        tail = head = NULL;

        for (dat = 1; dat <= 21; dat++)
                makeNode(&head, &tail, dat);

        displayList(head);
        displayList(head);
        free(head);
}

Append node to end of the list.

Append node to end of the list.


/**
 * Copyright (c) 2015-present, react-native-community.
 * All rights reserved.
 *
 * This source code is licensed under the MIT-style license found in the
 * LICENSE file in the root directory of this source tree.
 */

typedef CF_ENUM(int32_t, RNSVGVectorEffect) {
    kRNSVGVectorEffectDefault,
    kRNSVGVectorEffectNonScalingStroke,
    kRNSVGVectorEffectInherit,
    kRNSVGVectorEffectUri
};

[ios] Implement vectorEffect nonScalingStroke / non-scaling-stroke

Add missing header file


#ifndef __SYS_TYPES_H__
#define __SYS_TYPES_H__ 1

#include <MacTypes.h>
#include <alloca.h>
#include <string.h>

typedef short                int16_t;
typedef long                int32_t;
typedef long long        int64_t;

#define vorbis_size32_t long

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

#pragma options align=power

char *strdup(const char *inStr);

#pragma options align=reset

#if defined(__cplusplus)
}
#endif

#endif /* __SYS_TYPES_H__ */

#ifndef __SYS_TYPES_H__
#define __SYS_TYPES_H__ 1

#include <MacTypes.h>
#include <alloca.h>
#include <string.h>

typedef short                int16_t;
// typedef long                int32_t;
typedef long long        int64_t;

#define vorbis_size32_t long

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

#pragma options align=power

char *strdup(const char *inStr);

#pragma options align=reset

#if defined(__cplusplus)
}
#endif

#endif /* __SYS_TYPES_H__ */

Fix osx build (this is going to be removed soon anyways)


#ifndef PZLIB_H
#define PZLIB_H

typedef unsigned int psize_type;
typedef int pssize_type;
typedef pssize_type writerfunc(void *cookie, const void *buf, psize_type len);
typedef void closefunc(void*);

struct pz {
    writerfunc *wf;
    closefunc *cf;
};

inline pssize_type do_write(void *cookie, const void *buf, psize_type len) {
    struct pz* p = (struct pz*)cookie;
    return (p->wf)(cookie, buf, len);
}

inline void do_close(void *cookie) {
    struct pz* p = (struct pz*)cookie;
    (p->cf)(cookie);
}

#ifdef __cplusplus
extern "C" {
#endif

void *make_fd(int fd);
extern writerfunc write_fd;
extern closefunc free_fd;

#ifdef __cplusplus
}
#endif

#endif

#ifndef PZLIB_H
#define PZLIB_H

typedef unsigned int psize_type;
typedef int pssize_type;
typedef pssize_type writerfunc(void *cookie, const void *buf, psize_type len);
typedef void closefunc(void*);

struct pz {
    writerfunc *wf;
    closefunc *cf;
};

static inline pssize_type do_write(void *cookie, const void *buf, psize_type len) {
    struct pz* p = (struct pz*)cookie;
    return (p->wf)(cookie, buf, len);
}

static inline void do_close(void *cookie) {
    struct pz* p = (struct pz*)cookie;
    (p->cf)(cookie);
}

#ifdef __cplusplus
extern "C" {
#endif

void *make_fd(int fd);
extern writerfunc write_fd;
extern closefunc free_fd;

#ifdef __cplusplus
}
#endif

#endif

Replace inline with static inline to enable DEBUG build (linking actually)

It's all about bloody C89 vs C99 semantic...


#include "queue.h"

struct Queue
{
	size_t head;
	size_t tail;
	size_t size;
	void** e;
};

Queue* Queue_Create(size_t n)
{
	Queue* q = (Queue *)malloc(sizeof(Queue));
	q->size = n;
	q->head = q->tail = 1;
	q->e = (void **)malloc(sizeof(void*) * (n + 1));
	return q;
}

int Queue_Empty(Queue* q)
{
	return (q->head == q->tail);
}

Add helper function Queue empty implementation


#ifndef _NPY_PRIVATE_BUFFER_H_
#define _NPY_PRIVATE_BUFFER_H_

#ifdef NPY_ENABLE_MULTIPLE_COMPILATION
extern NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#else
NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#endif

#endif

#ifndef _NPY_PRIVATE_BUFFER_H_
#define _NPY_PRIVATE_BUFFER_H_

#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#else
NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#endif

#endif

Fix mispelled separate compilation macro.


#include "modlib.h"

uint16_t MODBUSSwapEndian( uint16_t Data )
{
    //Change big-endian to little-endian and vice versa

    uint8_t Swap;

	//Create 2 bytes long union
    union Conversion
    {
        uint16_t Data;
        uint8_t Bytes[2];
    } Conversion;

	//Swap bytes
    Conversion.Data = Data;
    Swap = Conversion.Bytes[0];
    Conversion.Bytes[0] = Conversion.Bytes[1];
    Conversion.Bytes[1] = Swap;

    return Conversion.Data;
}

uint16_t MODBUSCRC16( uint8_t *Data, uint16_t Length )
{
	//Calculate CRC16 checksum using given data and length

	uint16_t CRC = 0xFFFF;
	uint16_t i;
	uint8_t j;

	for ( i = 0; i < Length; i++ )
	{
		CRC ^= Data[i]; //XOR current data byte with CRC value

		for ( j = 8; j != 0; j-- )
		{
			//For each bit
			//Is least-significant-bit is set?
    		if ( ( CRC & 0x0001 ) != 0 )
			{
    			CRC >>= 1; //Shift to right and xor
    			CRC ^= 0xA001;
    		}
    		else
    			CRC >>= 1;
		}
	}
	return CRC;
}

#include "modlib.h"

uint16_t MODBUSSwapEndian( uint16_t Data )
{
    //Change big-endian to little-endian and vice versa

    uint8_t Swap;

	//Create 2 bytes long union
    union Conversion
    {
        uint16_t Data;
        uint8_t Bytes[2];
    } Conversion;

	//Swap bytes
    Conversion.Data = Data;
    Swap = Conversion.Bytes[0];
    Conversion.Bytes[0] = Conversion.Bytes[1];
    Conversion.Bytes[1] = Swap;

    return Conversion.Data;
}

uint16_t MODBUSCRC16( uint8_t *Data, uint16_t Length )
{
	//Calculate CRC16 checksum using given data and length

	uint16_t CRC = 0xFFFF;
	uint16_t i;
	uint8_t j;

	for ( i = 0; i < Length; i++ )
	{
		CRC ^= (uint16_t) Data[i]; //XOR current data byte with CRC value

		for ( j = 8; j != 0; j-- )
		{
			//For each bit
			//Is least-significant-bit is set?
    		if ( ( CRC & 0x0001 ) != 0 )
			{
    			CRC >>= 1; //Shift to right and xor
    			CRC ^= 0xA001;
    		}
    		else
    			CRC >>= 1;
		}
	}
	return CRC;
}

Add cast to uint16_t in CRC function

Add cast to uint16_t in CRC function


#import <Cocoa/Cocoa.h>
#include <gtk/gtk.h>

#if (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_6)
@interface _GNSMenuDelegate : NSObject <NSMenuDelegate> {}
#else
@interface _GNSMenuDelegate : NSObject {}
#endif
@end

#import <Cocoa/Cocoa.h>
#include <gtk/gtk.h>

#if (MAC_OS_X_VERSION_MIN_REQUIRED > MAC_OS_X_VERSION_10_5)
@interface _GNSMenuDelegate : NSObject <NSMenuDelegate> {}
#else
@interface _GNSMenuDelegate : NSObject {}
#endif
@end

Fix minimum version to one that exists in 10.5


#ifndef lilthumb
#define lilthumb

#include <ctime>
namespace lilthumb{

std::string timeString()
{
  time_t rawtime;
  struct tm * timeinfo;
  char buffer[80];

  time (&rawtime);
  timeinfo = localtime(&rawtime);

  strftime(buffer,80,"%d-%m-%Y %I:%M:%S",timeinfo);
  std::string str(buffer);

  return str;
}
}

#define logger(stream,message) stream << lilthumb::timeString() << " | "<< message << std::endl;
#endif

#ifndef lilthumb
#define lilthumb

#include <ctime>
#include <ostream>

namespace lilthumb{

std::string timeString()
{
  time_t rawtime;
  struct tm * timeinfo;
  char buffer[80];

  time (&rawtime);
  timeinfo = localtime(&rawtime);

  strftime(buffer,80,"%d-%m-%Y %I:%M:%S",timeinfo);
  std::string str(buffer);

  return str;
}

void stone( std::ostream& stream, std::string message )
{
  stream << timeString() << " | " << message << std::endl;
}

}

#endif

Change logger define to namespace stone function


#ifndef __LWP_CONFIG_H
#define __LWP_CONFIG_H

#include <stdint.h>
#include <stdbool.h>

typedef enum{
    CFLAG_NWKSKEY = (1<<0),
    CFLAG_APPSKEY = (1<<1),
    CFLAG_APPKEY  = (1<<2),
    CFLAG_JOINR   = (1<<3),
    CFLAG_JOINA   = (1<<4),
}config_flag_t;

typedef struct message{
    uint8_t *buf;
    int16_t len;
    struct message *next;
}message_t;

typedef struct{
    uint32_t flag;
    uint8_t nwkskey[16];
    uint8_t appskey[16];
    uint8_t appkey[16];
    uint8_t band;
    bool joinkey;
    uint8_t *joinr;
    uint8_t joinr_size;
    uint8_t *joina;
    uint8_t joina_size;
    message_t *message;
    message_t *maccmd;
}config_t;

int config_parse(const char *file, config_t *config);
void config_free(config_t *config);

#endif // __CONFIG_H

#ifndef __LWP_CONFIG_H
#define __LWP_CONFIG_H

#include <stdint.h>
#include <stdbool.h>

typedef enum{
    CFLAG_NWKSKEY = (1<<0),
    CFLAG_APPSKEY = (1<<1),
    CFLAG_APPKEY  = (1<<2),
    CFLAG_JOINR   = (1<<3),
    CFLAG_JOINA   = (1<<4),
}config_flag_t;

typedef struct message{
    uint8_t *buf;
    int16_t len;
    struct message *next;
}message_t;

typedef struct motes_abp{
    uint8_t band;
    uint8_t devaddr[4];
    uint8_t nwkskey[16];
    uint8_t appskey[16];
    struct message *next;
}motes_abp_t;

typedef struct motes_abp{
    uint8_t band;
    uint8_t devaddr[4];
    uint8_t nwkskey[16];
    uint8_t appskey[16];
    struct message *next;
}motes_abp_t;

typedef struct{
    uint32_t flag;
    uint8_t nwkskey[16];
    uint8_t appskey[16];
    uint8_t appkey[16];
    uint8_t band;
    bool joinkey;
    uint8_t *joinr;
    uint8_t joinr_size;
    uint8_t *joina;
    uint8_t joina_size;
    message_t *message;
    message_t *maccmd;
}config_t;

int config_parse(const char *file, config_t *config);
void config_free(config_t *config);

#endif // __CONFIG_H

Add motes_abp and motes_otaa link list structure definition.


//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author:  Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_RUNTIME_EXCEPTIONS_H
#define CLING_RUNTIME_EXCEPTIONS_H
namespace cling {
  namespace runtime {
    ///\brief Exception that is thrown when a null pointer dereference is found
    /// or a method taking non-null arguments is called with NULL argument.
    ///
    class cling_null_deref_exception { };
  } // end namespace runtime
} // end namespace cling
#endif // CLING_RUNTIME_EXCEPTIONS_H

//--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author:  Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//------------------------------------------------------------------------------

#ifndef CLING_RUNTIME_EXCEPTIONS_H
#define CLING_RUNTIME_EXCEPTIONS_H
namespace clang {
  class Sema;
}
namespace cling {
  namespace runtime {
    ///\brief Exception that is thrown when a null pointer dereference is found
    /// or a method taking non-null arguments is called with NULL argument.
    ///
    class cling_null_deref_exception {
    private:
      unsigned m_Location;
      clang::Sema* m_Sema;
    public:
      cling_null_deref_exception(void* Loc, clang::Sema* S);
      ~cling_null_deref_exception();

      void what() throw();

    };
  } // end namespace runtime
} // end namespace cling
#endif // CLING_RUNTIME_EXCEPTIONS_H

Add missing header method declarations.

Add missing header method declarations.


//===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// AST Consumers.
//
//===----------------------------------------------------------------------===//

#ifndef REWRITE_ASTCONSUMERS_H
#define REWRITE_ASTCONSUMERS_H

#include <string>

namespace llvm {
  class raw_ostream;
}
namespace clang {

class ASTConsumer;
class Diagnostic;
class LangOptions;
class Preprocessor;

// ObjC rewriter: attempts tp rewrite ObjC constructs into pure C code.
// This is considered experimental, and only works with Apple's ObjC runtime.
ASTConsumer *CreateObjCRewriter(const std::string &InFile,
                                llvm::raw_ostream *OS,
                                Diagnostic &Diags,
                                const LangOptions &LOpts,
                                bool SilenceRewriteMacroWarning);

/// CreateHTMLPrinter - Create an AST consumer which rewrites source code to
/// HTML with syntax highlighting suitable for viewing in a web-browser.
ASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP,
                               bool SyntaxHighlight = true,
                               bool HighlightMacros = true);

} // end clang namespace

#endif

//===--- ASTConsumers.h - ASTConsumer implementations -----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// AST Consumers.
//
//===----------------------------------------------------------------------===//

#ifndef REWRITE_ASTCONSUMERS_H
#define REWRITE_ASTCONSUMERS_H

#include <string>

namespace llvm {
  class raw_ostream;
}
namespace clang {

class ASTConsumer;
class Diagnostic;
class LangOptions;
class Preprocessor;

// ObjC rewriter: attempts to rewrite ObjC constructs into pure C code.
// This is considered experimental, and only works with Apple's ObjC runtime.
ASTConsumer *CreateObjCRewriter(const std::string &InFile,
                                llvm::raw_ostream *OS,
                                Diagnostic &Diags,
                                const LangOptions &LOpts,
                                bool SilenceRewriteMacroWarning);

/// CreateHTMLPrinter - Create an AST consumer which rewrites source code to
/// HTML with syntax highlighting suitable for viewing in a web-browser.
ASTConsumer *CreateHTMLPrinter(llvm::raw_ostream *OS, Preprocessor &PP,
                               bool SyntaxHighlight = true,
                               bool HighlightMacros = true);

} // end clang namespace

#endif

Fix typo spotted by Nico Weber.

Fix typo spotted by Nico Weber.

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


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

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

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

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

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

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

Disable db upgrade code for the moment.

Disable db upgrade code for the moment.


// RUN: %clang_cc1 %s -emit-llvm -O0 -o - | FileCheck %s
// PR 5406

// XFAIL: *
// XTARGET: arm

typedef struct { char x[3]; } A0;
void foo (int i, ...);

// CHECK: call void (i32, ...)* @foo(i32 1, i32 {{.*}}) nounwind
int main (void)
{
  A0 a3;
  a3.x[0] = 0;
  a3.x[0] = 0;
  a3.x[2] = 26;
  foo (1,  a3 );
  return 0;
}

// RUN: %clang_cc1 %s -emit-llvm -triple arm-apple-darwin -o - | FileCheck %s
// PR 5406

typedef struct { char x[3]; } A0;
void foo (int i, ...);

// CHECK: call arm_aapcscc  void (i32, ...)* @foo(i32 1, [1 x i32] {{.*}})
int main (void)
{
  A0 a3;
  a3.x[0] = 0;
  a3.x[0] = 0;
  a3.x[2] = 26;
  foo (1,  a3 );
  return 0;
}

Add a triple to this test and make sure it passes on arm where it was
supposed to.

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


#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"

#define MY_UUID { 0x78, 0x1D, 0x21, 0x66, 0x09, 0x09, 0x4F, 0x9C, 0x88, 0xFD, 0x89, 0x9B, 0x04, 0xBF, 0x5E, 0x32 }

PBL_APP_INFO(MY_UUID,
             "Pomade", "Jon Speicher",
             0, 1, /* App version */
             DEFAULT_MENU_ICON,
             APP_INFO_STANDARD_APP);

Window window;

void handle_init(AppContextRef ctx) {
  window_init(&window, "Pomade");
  window_stack_push(&window, true /* Animated */);
}

void pbl_main(void *params) {
  PebbleAppHandlers handlers = {
    .init_handler = &handle_init
  };
  app_event_loop(params, &handlers);
}

#include "pebble_os.h"
#include "pebble_app.h"
#include "pebble_fonts.h"

#define MY_UUID { 0x78, 0x1D, 0x21, 0x66, 0x09, 0x09, 0x4F, 0x9C, 0x88, 0xFD, 0x89, 0x9B, 0x04, 0xBF, 0x5E, 0x32 }

PBL_APP_INFO(MY_UUID,
             "Pomade", "Jon Speicher",
             0, 1, /* App version */
             DEFAULT_MENU_ICON,
             APP_INFO_STANDARD_APP);

Window window;
TextLayer timerLayer;

AppTimerHandle timer_handle;
#define COOKIE_MY_TIMER 1

void handle_timer(AppContextRef ctx, AppTimerHandle handle, uint32_t cookie) {

  if (cookie == COOKIE_MY_TIMER) {
      text_layer_set_text(&timerLayer, "Timer happened!");
  }

  // If you want the timer to run again you need to call `app_timer_send_event()`
  // again here.
}

void handle_init(AppContextRef ctx) {
  window_init(&window, "Pomade");
  window_stack_push(&window, true /* Animated */);

  text_layer_init(&timerLayer, window.layer.frame);
  text_layer_set_text(&timerLayer, "Waiting for timer...");
  layer_add_child(&window.layer, &timerLayer.layer);

  timer_handle = app_timer_send_event(ctx, 1500 /* milliseconds */, COOKIE_MY_TIMER);
}

void pbl_main(void *params) {
  PebbleAppHandlers handlers = {
    .init_handler = &handle_init,
    .timer_handler = &handle_timer
  };
  app_event_loop(params, &handlers);
}

Add framework timer code from Pebble feature_timer demo app


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

#ifndef LINKED_LIST_QUEUE_H
#define LINKED_LIST_QUEUE_H

#include <pthread.h>

#include "../function_queue.h"
#include "../qterror.h"

/*
 * This structure is a linked list node structure for function queue
 * elements.
 */
struct fqellnode {
	struct function_queue_element element; /* the element value */
	struct fqellnode* next; /* the address of the next node */
};

/*
 * This structure is used to store the function queue elements and any
 * persistant data necessary for the manipulation procedures.
 */
struct fqlinkedlist {
	struct fqellnode* head; /* a pointer to the head of the list */
	struct fqellnode* tail; /* a pointer to the tail of the list */
	size_t size; /* current number of elements */
};

extern const struct fqdispatchtable fqdispatchtablell;

#endif

Add header file for linked list queue

Add header file for linked list queue


namespace NJS::Class
{
	class Function
	{
	public:
		int cnt = 0;
		string code = "[native code]";
		void Delete();
		Function(void *_f);
		void *__NJS_VALUE;
		vector<pair<const char *, NJS::VAR>> __OBJECT;
		template <class... Args>
		NJS::VAR operator()(Args... args);
		explicit NJS::Class::Function::operator std::string() const
		{
			return "function () { " + code + " }";
		}
	};
} // namespace NJS::CLASS

namespace NJS::Class
{
	class Function
	{
	public:
		int cnt = 0;
		string code = "[native code]";
		void Delete();
		Function(void *_f);
		void *__NJS_VALUE;
		vector<pair<const char *, NJS::VAR>> __OBJECT;
		template <class... Args>
		NJS::VAR operator()(Args... args);
		explicit operator std::string() const
		{
			return "function () { " + code + " }";
		}
	};
} // namespace NJS::CLASS

Add function.toString() and source code if --debug


// Copyright (c) 2008 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 WEBKIT_GLUE_SCREEN_INFO_H_
#define WEBKIT_GLUE_SCREEN_INFO_H_

#include "base/gfx/rect.h"

namespace webkit_glue {

struct ScreenInfo {
  int depth;
  int depth_per_component;
  bool is_monochrome;
  gfx::Rect rect;
  gfx::Rect available_rect;
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_SCREEN_INFO_H_

Add missing file. Oops :(

Add missing file.  Oops :(

TBR=dglazkov

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

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

Former-commit-id: 6520b60844230204cf736f17b814d95b6c0e249b


#include <pal.h>

/**
 *
 * Caclulates the inverse sine (arc sine) of the argument 'a'. Arguments must be
 * in the range -1 to 1. The function does not check for illegal input values.
 * Results are in the range -pi/2 to pi/2.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
#include <math.h>
void p_asin_f32(const float *a, float *c, int n)
{

    int i;
    for (i = 0; i < n; i++) {
        *(c + i) = asinf(*(a + i));
    }
}

#include <math.h>
#include <pal.h>

static const float pi_2 = (float) M_PI / 2.f;

/*
 * 0 <= x <= 1
 * asin x = pi/2 - (1 - x)^(1/2) * (a0 + a1 * x + ... + a3 * x^3) + e(x)
 * |e(x)| <= 5 * 10^-5
 */
static inline float __p_asin_pos(const float x)
{
    const float a0 =  1.5707288f;
    const float a1 = -0.2121144f;
    const float a2 =  0.0742610f;
    const float a3 = -0.0187293f;
    float a_ = 1.f - x;
    float a;
    p_sqrt_f32(&a_, &a, 1);
    return pi_2 - a * (a0 + a1 * x + a2 * x * x + a3 * x * x * x);
}

/*
 * -1 <= x <= 1
 * asin(-x) = - asin x
 */
static inline float _p_asin(const float x)
{
    if (x >= 0.f)
        return __p_asin_pos(x);
    else
        return -1.f * __p_asin_pos(-x);
}

/**
 *
 * Caclulates the inverse sine (arc sine) of the argument 'a'. Arguments must be
 * in the range -1 to 1. The function does not check for illegal input values.
 * Results are in the range -pi/2 to pi/2.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
void p_asin_f32(const float *a, float *c, int n)
{

    int i;
    for (i = 0; i < n; i++) {
        c[i] = _p_asin(a[i]);
    }
}

Implement the inverse sine function.

math:asin: Implement the inverse sine function.

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


/*
 * @file _usage.h
 * @brief standardize help/usage output across all our programs
 * @internal
 *
 * Copyright 2007 Gentoo Foundation
 * Released under the GPLv2
 */

#define getoptstring_COMMON "Ch"
#define longopts_COMMON \
	{ "help",           0, NULL, 'h'}, \
	{ "nocolor",        0, NULL, 'C'},

#define case_RC_COMMON_GETOPT \
	case 'C': setenv ("RC_NOCOLOR", "yes", 1); break; \
	case 'h': usage (EXIT_SUCCESS); \
	default:  usage (EXIT_FAILURE);

Add --nocolor to more programs

Add --nocolor to more programs


/*-
 * Test 0083:	Check that the last instruction is BPF_RET.
 *
 * $FreeBSD$
 */

/* BPF program */
struct bpf_insn pc[] = {
	BPF_JUMP(BPF_JMP+BPF_JA, 0, 0, 0),
};

/* Packet */
u_char	pkt[] = {
	0x00,
};

/* Packet length seen on wire */
u_int	wirelen =	sizeof(pkt);

/* Packet length passed on buffer */
u_int	buflen =	sizeof(pkt);

/* Invalid instruction */
int	invalid =	1;

/* Expected return value */
u_int	expect =	0;

/* Expected signal */
#ifdef BPF_JIT_COMPILER
int	expect_signal =	SIGSEGV;
#else
int	expect_signal =	SIGABRT;
#endif

/*-
 * Test 0083:	Check that the last instruction is BPF_RET.
 *
 * $FreeBSD$
 */

/* BPF program */
struct bpf_insn pc[] = {
	BPF_STMT(BPF_LD|BPF_IMM, 0),
};

/* Packet */
u_char	pkt[] = {
	0x00,
};

/* Packet length seen on wire */
u_int	wirelen =	sizeof(pkt);

/* Packet length passed on buffer */
u_int	buflen =	sizeof(pkt);

/* Invalid instruction */
int	invalid =	1;

/* Expected return value */
u_int	expect =	0;

/* Expected signal */
#ifdef BPF_JIT_COMPILER
int	expect_signal =	SIGSEGV;
#else
int	expect_signal =	SIGABRT;
#endif

Adjust a test case and make it more jump optimization neutral for JIT case.


/*
   Copyright 2016 Vanderbilt University

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

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

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

#pragma once
#ifndef ACCRE_DNS_CACHE_H_INCLUDED
#define ACCRE_DNS_CACHE_H_INCLUDED

#include "tbx/toolbox_visibility.h"

#ifdef __cplusplus
extern "C" {
#endif

// Functions
TBX_API int tbx_dnsc_lookup(const char * name, char * byte_addr, char * ip_addr);
TBX_API int tbx_dnsc_shutdown();
TBX_API int tbx_dnsc_startup();
TBX_API int tbx_dnsc_startup_sized(int size);

// Preprocessor macros
#define DNS_ADDR_MAX 4
#define DNS_IPV4  0
#define DNS_IPV6  1

#ifdef __cplusplus
}
#endif

#endif

/*
   Copyright 2016 Vanderbilt University

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

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

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

#pragma once
#ifndef ACCRE_DNS_CACHE_H_INCLUDED
#define ACCRE_DNS_CACHE_H_INCLUDED

#include "tbx/toolbox_visibility.h"

#ifdef __cplusplus
extern "C" {
#endif

// Functions
TBX_API int tbx_dnsc_lookup(const char * name, char * byte_addr, char * ip_addr);
TBX_API int tbx_dnsc_shutdown();
TBX_API int tbx_dnsc_startup();
TBX_API int tbx_dnsc_startup_sized(int size);

// Preprocessor macros
#define DNS_ADDR_MAX 16
#define DNS_IPV4  0
#define DNS_IPV6  1

#ifdef __cplusplus
}
#endif

#endif

Add enough space in DNS cache for IPV6

Add enough space in DNS cache for IPV6

We have code supporting IPV6, but the structs only have enough space for
IPV4.


// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Eotvos Lorand University, Budapest, Hungary

#include "dpdk_model_v1model.h"
#include "util_packet.h"
#include "util_debug.h"

#include "dpdk_lib.h"
#include "stateful_memory.h"

#include <rte_ip.h>

void hash(uint16_t* result, enum_HashAlgorithm_t hash, uint16_t base, uint8_buffer_t data, uint32_t max, SHORT_STDPARAMS) {
    debug("    : Executing hash\n");
}

// SPDX-License-Identifier: Apache-2.0
// Copyright 2021 Eotvos Lorand University, Budapest, Hungary

#include "dpdk_model_v1model.h"
#include "util_packet.h"
#include "util_debug.h"

#include "dpdk_lib.h"
#include "stateful_memory.h"

#include "rte_hash_crc.h"

#include <rte_ip.h>

void hash(uint16_t* result, enum_HashAlgorithm_t hash, uint16_t base, uint8_buffer_t data, uint32_t max, SHORT_STDPARAMS) {
    debug("    : Executing hash\n");
    dbg_bytes(data.buffer, data.buffer_size, "        Input: " T4LIT(%d) " bytes: ", data.buffer_size);
    if (hash == enum_HashAlgorithm_crc32){
        uint32_t crc32_result = rte_hash_crc(data.buffer, data.buffer_size, 0xffffffff);
        memcpy(result, &crc32_result, 4);
    }
    else if (hash == enum_HashAlgorithm_identity) {
        memcpy(result, data.buffer, data.buffer_size > 8 ? 8 : data.buffer_size);
    }
    else {
        debug("    : Unkown hashing method!\n");
    }
    dbg_bytes(result, 4, "        Result:");
}

Add crc32 and identity hash functions

Add crc32 and identity hash functions


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

void runStep(struct stack_node node, struct stack_node *top) {
  switch( node.data.type ) {
  case 0:
    struct stack_node push;
    push.cdr = top;
    push.data = node.data;
    *top = push;
    break;
  }
}

Add support for pushing ints to the stack.


#include "ByteProducer.h"

static void _start (struct ByteProducerInternal *self, struct ByteListenerInternal *listener) {
  ByteProducer *producer = (ByteProducer *) self;
  producer->start (producer, (ByteListener *) listener);
}
static void _stop (struct ByteProducerInternal *self) {
  ByteProducer *producer = (ByteProducer *) self;
  producer->stop (producer);
};

ByteProducer *byte_producer_create (byte_producer_start start, byte_producer_stop stop) {
  ByteProducer *producer = xmalloc (sizeof (ByteProducer));
  producer->start = start;
  producer->stop = stop;
  producer->_start = _start;
  producer->_stop = _stop;
  return producer;
}

Add a factory for Producer<Byte>

Add a factory for Producer<Byte>


{
  struct RClass *Control_class = mrb_define_class_under(mrb, UI_module(mrb), "Control", mrb->object_class);
#define CONTROL_SUBCLASS(name) { struct RClass* subclass = mrb_define_class_under(mrb, UI_module(mrb), #name, Control_class); }
  CONTROL_SUBCLASS(Area)
  CONTROL_SUBCLASS(Box)
  CONTROL_SUBCLASS(Button)
  CONTROL_SUBCLASS(Checkbox)
  CONTROL_SUBCLASS(ColorButton)
  CONTROL_SUBCLASS(Combobox)
  CONTROL_SUBCLASS(DateTimePicker)
  CONTROL_SUBCLASS(EditableCombobox)
  CONTROL_SUBCLASS(Entry)
  CONTROL_SUBCLASS(FontButton)
  CONTROL_SUBCLASS(Form)
  CONTROL_SUBCLASS(Grid)
  CONTROL_SUBCLASS(Group)
  CONTROL_SUBCLASS(Label)
  CONTROL_SUBCLASS(MultilineEntry)
  CONTROL_SUBCLASS(ProgressBar)
  CONTROL_SUBCLASS(RadioButtons)
  CONTROL_SUBCLASS(Separator)
  CONTROL_SUBCLASS(Slider)
  CONTROL_SUBCLASS(Spinbox)
  CONTROL_SUBCLASS(Tab)
  CONTROL_SUBCLASS(Window)
#undef CONTROL_SUBCLASS
}

{
  struct RClass *Control_class = mrb_define_class_under(mrb, UI_module(mrb), "Control", mrb->object_class);
#define CONTROL_SUBCLASS(name) { mrb_define_class_under(mrb, UI_module(mrb), #name, Control_class); }
  CONTROL_SUBCLASS(Area)
  CONTROL_SUBCLASS(Box)
  CONTROL_SUBCLASS(Button)
  CONTROL_SUBCLASS(Checkbox)
  CONTROL_SUBCLASS(ColorButton)
  CONTROL_SUBCLASS(Combobox)
  CONTROL_SUBCLASS(DateTimePicker)
  CONTROL_SUBCLASS(EditableCombobox)
  CONTROL_SUBCLASS(Entry)
  CONTROL_SUBCLASS(FontButton)
  CONTROL_SUBCLASS(Form)
  CONTROL_SUBCLASS(Grid)
  CONTROL_SUBCLASS(Group)
  CONTROL_SUBCLASS(Label)
  CONTROL_SUBCLASS(MultilineEntry)
  CONTROL_SUBCLASS(ProgressBar)
  CONTROL_SUBCLASS(RadioButtons)
  CONTROL_SUBCLASS(Separator)
  CONTROL_SUBCLASS(Slider)
  CONTROL_SUBCLASS(Spinbox)
  CONTROL_SUBCLASS(Tab)
  CONTROL_SUBCLASS(Window)
#undef CONTROL_SUBCLASS
}

Address compiler warning - unused variable


#import <UIKit/UIKit.h>

#define SUPPORTS_UNDOCUMENTED_API	1

@interface UIColor (expanded)
- (CGColorSpaceModel) colorSpaceModel;
- (NSString *) colorSpaceString;

- (BOOL) canProvideRGBComponents;
- (NSArray *) arrayFromRGBAComponents;
- (CGFloat) red;
- (CGFloat) blue;
- (CGFloat) green;
- (CGFloat) alpha;

- (NSString *) stringFromColor;
- (NSString *) hexStringFromColor;

#if SUPPORTS_UNDOCUMENTED_API
// Optional Undocumented API calls
- (NSString *) fetchStyleString;
- (UIColor *) rgbColor; // Via Poltras
#endif

+ (UIColor *) colorWithString: (NSString *) stringToConvert;
+ (UIColor *) colorWithHexString: (NSString *) stringToConvert;

@property (readonly)	CGFloat red;
@property (readonly)	CGFloat green;
@property (readonly)	CGFloat blue;
@property (readonly)	CGFloat alpha;
@end

#import <UIKit/UIKit.h>

#define SUPPORTS_UNDOCUMENTED_API	1

@interface UIColor (expanded)
- (CGColorSpaceModel) colorSpaceModel;
- (NSString *) colorSpaceString;

- (BOOL) canProvideRGBComponents;
- (NSArray *) arrayFromRGBAComponents;
- (CGFloat) red;
- (CGFloat) blue;
- (CGFloat) green;
- (CGFloat) alpha;

- (NSString *) stringFromColor;
- (NSString *) hexStringFromColor;

#if SUPPORTS_UNDOCUMENTED_API
// Optional Undocumented API calls
- (NSString *) fetchStyleString;
- (UIColor *) rgbColor; // Via Poltras
#endif

+ (UIColor *) colorWithString: (NSString *) stringToConvert;
+ (UIColor *) colorWithHexString: (NSString *) stringToConvert;

@property (nonatomic, readonly)	CGFloat red;
@property (nonatomic, readonly)	CGFloat green;
@property (nonatomic, readonly)	CGFloat blue;
@property (nonatomic, readonly)	CGFloat alpha;
@end

Declare the properties as nonatomic

Declare the properties as nonatomic


// LAF Base Library
// Copyright (c) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef BASE_WIN_COMPTR_H_INCLUDED
#define BASE_WIN_COMPTR_H_INCLUDED
#pragma once

#if !defined(_WIN32)
  #error This header file can be used only on Windows platform
#endif

#include "base/disable_copying.h"

namespace base {

  template<class T>
  class ComPtr {
  public:
    ComPtr() : m_ptr(nullptr) { }
    ~ComPtr() { reset(); }
    T** operator&() { return &m_ptr; }
    T* operator->() { return m_ptr; }

    T* get() {
      return m_ptr;
    }

    void reset() {
      if (m_ptr) {
        m_ptr->Release();
        m_ptr = nullptr;
      }
    }

  private:
    T* m_ptr;

    DISABLE_COPYING(ComPtr);
  };

} // namespace base

#endif

// LAF Base Library
// Copyright (c) 2021 Igara Studio S.A.
// Copyright (c) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef BASE_WIN_COMPTR_H_INCLUDED
#define BASE_WIN_COMPTR_H_INCLUDED
#pragma once

#if !defined(_WIN32)
  #error This header file can be used only on Windows platform
#endif

#include <algorithm>

namespace base {

  template<class T>
  class ComPtr {
  public:
    ComPtr() : m_ptr(nullptr) {
    }

    ComPtr<T>(const ComPtr<T>& p) : m_ptr(p.m_ptr) {
      if (m_ptr)
        m_ptr->AddRef();
    }

    ComPtr(ComPtr&& tmp) {
      std::swap(m_ptr, tmp.m_ptr);
    }

    ~ComPtr() {
      reset();
    }

    T** operator&() { return &m_ptr; }
    T* operator->() { return m_ptr; }
    operator bool() const { return m_ptr != nullptr; }

    // Add new reference using operator=()
    ComPtr<T>& operator=(const ComPtr<T>& p) {
      if (m_ptr)
        m_ptr->Release();
      m_ptr = p.m_ptr;
      if (m_ptr)
        m_ptr->AddRef();
      return *this;
    }

    ComPtr& operator=(std::nullptr_t) {
      reset();
      return *this;
    }

    T* get() {
      return m_ptr;
    }

    void reset() {
      if (m_ptr) {
        m_ptr->Release();
        m_ptr = nullptr;
      }
    }

  private:
    T* m_ptr;
  };

} // namespace base

#endif

[win] Add some extra operators to base::ComPtr


#define _GNU_SOURCE /* asprintf */
#include <string.h>

#include "support.h"

#include "csync_private.h"
#include "vio/csync_vio.h"

CSYNC *csync;

static void setup(void) {
  csync_create(&csync);
  csync_init(csync);
}

static void teardown(void) {
  csync_destroy(csync);
}

START_TEST (check_csync_vio_load)
{
  fail_unless(csync_vio_init(csync, "smb", NULL) == 0, NULL);

  csync_vio_shutdown(csync);
}
END_TEST

static Suite *csync_vio_suite(void) {
  Suite *s = suite_create("csync_vio");

  create_case_fixture(s, "check_csync_vio_load", check_csync_vio_load, setup, teardown);

  return s;
}

int main(void) {
  int nf;

  Suite *s = csync_vio_suite();

  SRunner *sr;
  sr = srunner_create(s);
#if 0
  srunner_set_fork_status(sr, CK_NOFORK);
#endif
  srunner_run_all(sr, CK_VERBOSE);
  nf = srunner_ntests_failed(sr);
  srunner_free(sr);

  return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Add test for loading the module.

Add test for loading the module.


/*=============================================================================

Copyright 2008 Francois Laupretre (francois@tekwire.net)

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

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

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

#ifndef __ID_H
#define __ID_H

/*----------------------------------------------*/

extern void change_id(const char *string);

/*----------------------------------------------*/
#endif	/* __ID_H */

Add copyright banner to source file

Add copyright banner to source file


#ifndef	TIMEOUT_QUEUE_H
#define	TIMEOUT_QUEUE_H

#include <map>

class TimeoutQueue {
	typedef std::map<NanoTime, CallbackQueue> timeout_map_t;

	LogHandle log_;
	timeout_map_t timeout_queue_;
public:
	TimeoutQueue(void)
	: log_("/event/timeout/queue"),
	  timeout_queue_()
	{ }

	~TimeoutQueue()
	{ }

	bool empty(void) const
	{
		timeout_map_t::const_iterator it;

		/*
		 * Since we allow elements within each CallbackQueue to be
		 * cancelled, we must scan them.
		 *
		 * XXX
		 * We really shouldn't allow this, even if it means we have
		 * to specialize CallbackQueue for this purpose or add
		 * virtual methods to it.  As it is, we can return true
		 * for empty and for ready at the same time.  And in those
		 * cases we have to call perform to garbage collect the
		 * unused CallbackQueues.  We'll, quite conveniently,
		 * never make that call.  Yikes.
		 */
		for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) {
			if (it->second.empty())
				continue;
			return (false);
		}
		return (true);
	}

	Action *append(uintmax_t, SimpleCallback *);
	uintmax_t interval(void) const;
	void perform(void);
	bool ready(void) const;
};

#endif /* !TIMEOUT_QUEUE_H */

#ifndef	TIMEOUT_QUEUE_H
#define	TIMEOUT_QUEUE_H

#include <map>

#include <common/time/time.h>

class TimeoutQueue {
	typedef std::map<NanoTime, CallbackQueue> timeout_map_t;

	LogHandle log_;
	timeout_map_t timeout_queue_;
public:
	TimeoutQueue(void)
	: log_("/event/timeout/queue"),
	  timeout_queue_()
	{ }

	~TimeoutQueue()
	{ }

	bool empty(void) const
	{
		timeout_map_t::const_iterator it;

		/*
		 * Since we allow elements within each CallbackQueue to be
		 * cancelled, we must scan them.
		 *
		 * XXX
		 * We really shouldn't allow this, even if it means we have
		 * to specialize CallbackQueue for this purpose or add
		 * virtual methods to it.  As it is, we can return true
		 * for empty and for ready at the same time.  And in those
		 * cases we have to call perform to garbage collect the
		 * unused CallbackQueues.  We'll, quite conveniently,
		 * never make that call.  Yikes.
		 */
		for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) {
			if (it->second.empty())
				continue;
			return (false);
		}
		return (true);
	}

	Action *append(uintmax_t, SimpleCallback *);
	uintmax_t interval(void) const;
	void perform(void);
	bool ready(void) const;
};

#endif /* !TIMEOUT_QUEUE_H */

Use new NanoTime location header, oops.

Use new NanoTime location header, oops.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@799 4068ffdb-0463-0410-8185-8cc71e3bd399


/*-
 * Copyright (c) 2004 Doug Rabson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$FreeBSD$
 */

#include <stdint.h>
#include <machine/alpha_cpu.h>

void
_set_tp(void *tp)
{

    alpha_pal_wrunique((uintptr_t) tp);
}

/*-
 * Copyright (c) 2004 Doug Rabson
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$FreeBSD$
 */

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

#include <sys/types.h>
#include <machine/alpha_cpu.h>

void
_set_tp(void *tp)
{

    alpha_pal_wrunique((uintptr_t) tp);
}

Fix alpha build and add __FBSDID.

Fix alpha build and add __FBSDID.

PR: 70518


#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATE_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATE_H
#include "InputHandler.h"
#include "ComponentHandler.h"
#include "../GraphicsDLL/Camera.h"
#include "../NetworkDLL/NetworkModule.h"

//class NetworkModule;
class GameStateHandler;
class GameState
{
private:	//Variables
protected:
	GameStateHandler* m_gsh;
	ComponentHandler* m_cHandler;
	Camera* m_cameraRef;

	//static NetworkModule* m_networkModule;
	char* m_ip = "192.168.1.25";	//Tobias NUC Specific local ip

	int InitializeBase(GameStateHandler* gsh, ComponentHandler* cHandler, Camera* cameraRef);
public:
	GameState();
	virtual ~GameState();

	virtual int ShutDown() = 0;
	//Returns 1 for success and 0 for failure
	virtual int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler, Camera* cameraRef) = 0;

	virtual int Update(float dt, InputHandler * inputHandler) = 0;
private:	//Helper functions
};

#endif

#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATE_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATE_H
#include "InputHandler.h"
#include "ComponentHandler.h"
#include "../GraphicsDLL/Camera.h"
//#include "../NetworkDLL/NetworkModule.h"

//class NetworkModule;
class GameStateHandler;
class GameState
{
private:	//Variables
protected:
	GameStateHandler* m_gsh;
	ComponentHandler* m_cHandler;
	Camera* m_cameraRef;

	//static NetworkModule* m_networkModule;
	char* m_ip = "192.168.1.25";	//Tobias NUC Specific local ip

	int InitializeBase(GameStateHandler* gsh, ComponentHandler* cHandler, Camera* cameraRef);
public:
	GameState();
	virtual ~GameState();

	virtual int ShutDown() = 0;
	//Returns 1 for success and 0 for failure
	virtual int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler, Camera* cameraRef) = 0;

	virtual int Update(float dt, InputHandler * inputHandler) = 0;
private:	//Helper functions
};

#endif

UPDATE doubble checked for Fransisco

UPDATE doubble checked for Fransisco


#include <srts/stratego.h>
#include "stratego-lib-common.h"

ATerm SSL_get_list_length(ATerm term)
{
  ATermList list = NULL;
  ATerm result = NULL;

  if(!ATisList(term)) {
    _fail(term);
  }

  list = (ATermList) term;
  result = (ATerm) ATmakeInt(ATgetLength(term));
  return result;
}

#include <srts/stratego.h>
#include "stratego-lib-common.h"

ATerm SSL_get_list_length(ATerm term)
{
  ATermList list = NULL;
  ATerm result = NULL;

  if(!ATisList(term)) {
    _fail(term);
  }

  list = (ATermList) term;
  result = (ATerm) ATmakeInt(ATgetLength(list));
  return result;
}

Fix in native implementation of length strategy: ATgetLength should be
applied to an ATermList.

svn path=/strategoxt/trunk/; revision=16203


/*	$OpenBSD: db_interface.c,v 1.2 1996/12/28 06:21:50 rahnds Exp $	*/

#include <sys/param.h>
#include <sys/proc.h>

#include <machine/db_machdep.h>
void
Debugger()
{
	db_trap(T_BREAKPOINT);
/*
	__asm volatile ("tw 4,2,2");
*/
}

/*	$OpenBSD: db_interface.c,v 1.3 1999/07/05 20:23:08 rahnds Exp $	*/

#include <sys/param.h>
#include <sys/proc.h>

#include <machine/db_machdep.h>
void
Debugger()
{
/*
	db_trap(T_BREAKPOINT);
*/
	__asm volatile ("tw 4,2,2");
}

Use a breakpoint to cause an exception to cause the registers to be saved for debugging purposes.


#ifndef NAVIGATIONWIDGET_H
#define NAVIGATIONWIDGET_H

#include <QWidget>
#include <QLabel>
#include "qnavigation_global.h"

class QLabel;
class QPushButton;

namespace QNavigation
{

class SlidingStackedWidget;
class NavigationWidgetPrivate;

class NavigationWidget : public QWidget
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(NavigationWidget)
    NavigationWidgetPrivate * const d_ptr;

    Q_PRIVATE_SLOT(d_func(), void cleanup())

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

    bool level() const;
    QLabel *titleLabel() const;
    QPushButton *backButton() const;
    SlidingStackedWidget *stackedWidget() const;

    bool navigationBarHidden() const;
    void setNavigationBarHidden(bool hidden);

public slots:
    void push(QWidget *item);
    void pop();
    void popToTop();
};

}   // namespace QNavigation

#endif // NAVIGATIONWIDGET_H

#ifndef QNAVIGATION_NAVIGATIONWIDGET_H
#define QNAVIGATION_NAVIGATIONWIDGET_H

#include <QWidget>
#include <QLabel>
#include "qnavigation_global.h"

class QLabel;
class QPushButton;

namespace QNavigation
{

class SlidingStackedWidget;
class NavigationWidgetPrivate;

class NavigationWidget : public QWidget
{
    Q_OBJECT
    Q_DECLARE_PRIVATE(NavigationWidget)
    NavigationWidgetPrivate * const d_ptr;

    Q_PRIVATE_SLOT(d_func(), void cleanup())

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

    bool level() const;
    QLabel *titleLabel() const;
    QPushButton *backButton() const;
    SlidingStackedWidget *stackedWidget() const;

    bool navigationBarHidden() const;
    void setNavigationBarHidden(bool hidden);

public slots:
    void push(QWidget *item);
    void pop();
    void popToTop();
};

}   // namespace QNavigation

#endif // QNAVIGATION_NAVIGATIONWIDGET_H

Fix inclusion guard for NavigationWidget


/*
 * libjingle
 * Copyright 2014, Google Inc.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 *  1. Redistributions of source code must retain the above copyright notice,
 *     this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright notice,
 *     this list of conditions and the following disclaimer in the documentation
 *     and/or other materials provided with the distribution.
 *  3. The name of the author may not be used to endorse or promote products
 *     derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

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

#import "RTCVideoRenderer.h"

@class RTCEAGLVideoView;
@protocol RTCEAGLVideoViewDelegate

- (void)videoView:(RTCEAGLVideoView*)videoView didChangeVideoSize:(CGSize)size;

@end

@class RTCVideoTrack;
// RTCEAGLVideoView renders |videoTrack| onto itself using OpenGLES.
@interface RTCEAGLVideoView : UIView

@property(nonatomic, strong) RTCVideoTrack* videoTrack;
@property(nonatomic, weak) id<RTCEAGLVideoViewDelegate> delegate;

@end

Add missing WebRTC header file

Add missing WebRTC header file


//
//  InstapaperAPI.h
//  newsyc
//
//  Created by Grant Paul on 3/10/11.
//  Copyright 2011 Xuzz Productions, LLC. All rights reserved.
//

#import <HNKit/NSString+URLEncoding.h>

#define kInstapaperAPIRootURL [NSURL URLWithString:@"https://instapaper.com/api/"]
#define kInstapaperAPIAuthenticationURL [NSURL URLWithString:[[kInstapaperAPIRootURL absoluteString] stringByAppendingString:@"authenticate"]]
#define kInstapaperAPIAddItemURL [NSURL URLWithString:[[kInstapaperAPIRootURL absoluteString] stringByAppendingString:@"add"]]

//
//  InstapaperAPI.h
//  newsyc
//
//  Created by Grant Paul on 3/10/11.
//  Copyright 2011 Xuzz Productions, LLC. All rights reserved.
//

#import <HNKit/NSString+URLEncoding.h>

#define kInstapaperAPIRootURL [NSURL URLWithString:@"https://www.instapaper.com/api/"]
#define kInstapaperAPIAuthenticationURL [NSURL URLWithString:[[kInstapaperAPIRootURL absoluteString] stringByAppendingString:@"authenticate"]]
#define kInstapaperAPIAddItemURL [NSURL URLWithString:[[kInstapaperAPIRootURL absoluteString] stringByAppendingString:@"add"]]

Fix Instapaper Root API issue

Fix Instapaper Root API issue

Fixed issue that was causing login request to return a 403.


#ifndef MCLISP_CONS_H_
#define MCLISP_CONS_H_

namespace mclisp
{

class ConsCell
{
public:
    ConsCell(): car_(nullptr), cdr_(nullptr) {}
    ConsCell(ConsCell* car, ConsCell* cdr): car_(car), cdr_(cdr) {}

private:
    ConsCell* car_;
    ConsCell* cdr_;
};

} // namespace mclisp

#endif // MCLISP_CONS_H_

#ifndef MCLISP_CONS_H_
#define MCLISP_CONS_H_

namespace mclisp
{

class ConsCell
{
public:
    ConsCell(): car_(nullptr), cdr_(nullptr) {}
    ConsCell(ConsCell* car, ConsCell* cdr): car_(car), cdr_(cdr) {}

    ConsCell* car_;
    ConsCell* cdr_;
};

} // namespace mclisp

#endif // MCLISP_CONS_H_

Make Cons::car_ and Cons::cdr_ public members.


/*
 * Lift
 *
 * Copyright (c) 2014-2015, NVIDIA CORPORATION
 * Copyright (c) 2015, Nuno Subtil <subtil@gmail.com>
 * Copyright (c) 2015, Roche Molecular Systems Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * Redistributions in binary form must reproduce the above copyright
 *      notice, this list of conditions and the following disclaimer in the
 *      documentation and/or other materials provided with the distribution.
 *    * Neither the name of the copyright holders nor the names of its
 *      contributors may be used to endorse or promote products derived from
 *      this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#pragma once

namespace lift {

#include "../types.h"
#include "../backends.h"
#include "../decorators.h"

// a statically-sized local memory vector
template <typename T, uint32 max_storage_size>
struct local_memory
{
    typedef T        value_type;
    typedef T&       reference;
    typedef const T& const_reference;
    typedef T*       pointer;
    typedef const T* const_pointer;
    typedef uint32   index_type;
    typedef uint32   size_type;

    value_type storage[max_storage_size];
    size_type storage_size = max_storage_size;

    LIFT_HOST_DEVICE local_memory() = default;

    LIFT_HOST_DEVICE void resize(size_type count)
    {
        storage_size = count;
    }

    LIFT_HOST_DEVICE size_type size(void) const
    {
        return storage_size;
    }

    LIFT_HOST_DEVICE pointer data(void)
    {
        return storage;
    }

    LIFT_HOST_DEVICE const_pointer data(void) const
    {
        return storage;
    }

    LIFT_HOST_DEVICE reference operator[] (const size_type index)
    {
        return storage[index];
    }

    LIFT_HOST_DEVICE const_reference operator[] (const size_type index) const
    {
        return storage[index];
    }
};

} // namespace lift

memory: Add a local memory vector implementation

Adds a statically allocated memory container. This is meant for accessing local
memory on the GPU, but can use stack memory on the CPU.


#include "emscripten.h"
#include <stdlib.h>
#include <unistd.h>
#include "param.h"

int os_preamble()
{
    if (access("/dev/zero", R_OK))
        EM_ASM(({ FS.createDevice('/dev', 'zero', function () { return 0; }); }),/* dummy arg */0);

    EM_ASM_(({
        if (ENVIRONMENT_IS_NODE) {
            var mnt = Pointer_stringify($0);
            FS.mkdir(mnt);
            FS.mount(NODEFS, { root: '/' }, mnt);
            FS.chdir(mnt + process.cwd());
        }
    }), MOUNT_POINT);

    return 0;
}

#include "emscripten.h"
#include <stdlib.h>
#include <unistd.h>
#include "param.h"

int os_preamble()
{
    if (access("/dev/zero", R_OK))
        EM_ASM(({ FS.createDevice('/dev', 'zero', function () { return 0; }); }),/* dummy arg */0);

    EM_ASM_(({
        if (ENVIRONMENT_IS_NODE) {
            var len = 1024; /* arbitrary */
            var mnt = UTF8ToString($0, len);
            FS.mkdir(mnt);
            FS.mount(NODEFS, { root: '/' }, mnt);
            FS.chdir(mnt + process.cwd());
        }
    }), MOUNT_POINT);

    return 0;
}

Replace removed Pointer_stringify with UTF8ToString


// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s
// RUN: grep  "# DW_TAG_formal_parameter" %t.s | count 4
// Radar 8122864
// XFAIL: powerpc
static int foo(int a, int j) {
  int k = 0;
  if (a)
    k = a + j;
  else
    k = j;
  return k;
}
int bar(int o, int p) {

  return foo(o, p);
}

// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s
// RUN: grep  "# DW_TAG_formal_parameter" %t.s | count 4
// Radar 8122864
// XTARGET: x86,darwin
static int foo(int a, int j) {
  int k = 0;
  if (a)
    k = a + j;
  else
    k = j;
  return k;
}
int bar(int o, int p) {

  return foo(o, p);
}

Make this test darwin specific.

Make this test darwin specific.

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


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

/** Copy all the data from an \c ibuf to an \c obuf. */
int obuf_copyfromfd(int in, obuf* out)
{
  long rd;
  if (obuf_error(out)) return 0;
  out->count = 0;
  for (;;) {
    if ((rd = read(in,
		   out->io.buffer + out->bufpos,
		   out->io.bufsize - out->bufpos)) == -1)
      return 0;
    if (rd == 0)
      break;
    out->count += rd;
    if (!obuf_flush(out))
      return 0;
  }
  return 1;
}

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

/** Copy all the data from an \c ibuf to an \c obuf. */
int obuf_copyfromfd(int in, obuf* out)
{
  long rd;
  if (obuf_error(out)) return 0;
  out->count = 0;
  for (;;) {
    if ((rd = read(in,
		   out->io.buffer + out->bufpos,
		   out->io.bufsize - out->bufpos)) == -1)
      return 0;
    if (rd == 0)
      break;
    out->bufpos += rd;
    if (out->io.buflen < out->bufpos)
      out->io.buflen = out->bufpos;
    if (!obuf_flush(out))
      return 0;
    out->count += rd;
  }
  return 1;
}

Mark the copied-in data as being present before flushing the buffer. Without this patch, no data is ever written.


#include "test_parser.h"

void and_false(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("And"),
    rule_init(
      "And",
      sequence(
        and(terminal("hello")),
        terminal("h")
      )
    ), 1
  );

  parse_t *result = parse("help", grammar);
  assert_null(result);
}

void and_true(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("And"),
    rule_init(
      "And",
      sequence(
        and(terminal("hello")),
        terminal("h")
      )
    ), 1
  );

  parse_t *result = parse("hello", grammar);
  assert_non_null(result);
  assert_int_equal(result->length, 1);
  assert_int_equal(result->n_children, 1);

  assert_int_equal(result->children[0].length, 1);
  assert_int_equal(result->children[0].n_children, 0);
}

#include "test_parser.h"

void and_false(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("And"),
    rule_init(
      "And",
      sequence(
        and(terminal("hello")),
        terminal("h")
      )
    ), 1
  );

  parse_result_t *result = parse("help", grammar);
  assert_non_null(result);
  assert_true(is_error(result));
}

void and_true(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("And"),
    rule_init(
      "And",
      sequence(
        and(terminal("hello")),
        terminal("h")
      )
    ), 1
  );

  parse_result_t *result = parse("hello", grammar);
  assert_non_null(result);
  assert_true(is_success(result));

  parse_t *suc = result->data.result;
  assert_int_equal(suc->length, 1);
  assert_int_equal(suc->n_children, 1);

  assert_int_equal(suc->children[0].length, 1);
  assert_int_equal(suc->children[0].n_children, 0);
}

Use new API for and parsing

Use new API for and parsing


//===------ JITSymbolFlags.h - Flags for symbols in the JIT -----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Symbol flags for symbols in the JIT (e.g. weak, exported).
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_EXECUTIONENGINE_JITSYMBOLFLAGS_H
#define LLVM_EXECUTIONENGINE_JITSYMBOLFLAGS_H

#include "llvm/IR/GlobalValue.h"

namespace llvm {

/// @brief Flags for symbols in the JIT.
enum class JITSymbolFlags : char {
  None = 0,
  Weak = 1U << 0,
  Exported = 1U << 1
};

JITSymbolFlags operator|(JITSymbolFlags LHS, JITSymbolFlags RHS) {
  typedef std::underlying_type<JITSymbolFlags>::type UT;
  return static_cast<JITSymbolFlags>(
           static_cast<UT>(LHS) | static_cast<UT>(RHS));
}

JITSymbolFlags& operator |=(JITSymbolFlags &LHS, JITSymbolFlags RHS) {
  LHS = LHS | RHS;
  return LHS;
}

JITSymbolFlags operator&(JITSymbolFlags LHS, JITSymbolFlags RHS) {
  typedef std::underlying_type<JITSymbolFlags>::type UT;
  return static_cast<JITSymbolFlags>(
           static_cast<UT>(LHS) & static_cast<UT>(RHS));
}

JITSymbolFlags& operator &=(JITSymbolFlags &LHS, JITSymbolFlags RHS) {
  LHS = LHS & RHS;
  return LHS;
}

/// @brief Base class for symbols in the JIT.
class JITSymbolBase {
public:
  JITSymbolBase(JITSymbolFlags Flags) : Flags(Flags) {}

  JITSymbolFlags getFlags() const { return Flags; }

  bool isWeak() const {
    return (Flags & JITSymbolFlags::Weak) == JITSymbolFlags::Weak;
  }

  bool isExported() const {
    return (Flags & JITSymbolFlags::Exported) == JITSymbolFlags::Exported;
  }

  static JITSymbolFlags flagsFromGlobalValue(const GlobalValue &GV) {
    JITSymbolFlags Flags = JITSymbolFlags::None;
    if (GV.hasWeakLinkage())
      Flags |= JITSymbolFlags::Weak;
    if (!GV.hasLocalLinkage() && !GV.hasHiddenVisibility())
      Flags |= JITSymbolFlags::Exported;
    return Flags;

  }

private:
  JITSymbolFlags Flags;
};

} // end namespace llvm

#endif

[Orc][MCJIT][RuntimeDyld] Add header that was accidentally left out of r231724.

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


#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include "check_check.h"

int main (void)
{
  int n;
  SRunner *sr;

  fork_setup();
  setup_fixture();
  sr = srunner_create (make_master_suite());
  srunner_add_suite(sr, make_list_suite());
  srunner_add_suite(sr, make_msg_suite());
  srunner_add_suite(sr, make_log_suite());
  srunner_add_suite(sr, make_limit_suite());
  srunner_add_suite(sr, make_fork_suite());
  srunner_add_suite(sr, make_fixture_suite());
  srunner_add_suite(sr, make_pack_suite());

  setup();
  printf ("Ran %d tests in subordinate suite\n", sub_nfailed);
  srunner_run_all (sr, CK_NORMAL);
  cleanup();
  fork_teardown();
  teardown_fixture();
  n = srunner_ntests_failed(sr);
  srunner_free(sr);
  return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include "check_check.h"

int main (void)
{
  int n;
  SRunner *sr;

  fork_setup();
  setup_fixture();
  sr = srunner_create (make_master_suite());
  srunner_add_suite(sr, make_list_suite());
  srunner_add_suite(sr, make_msg_suite());
  srunner_add_suite(sr, make_log_suite());
  srunner_add_suite(sr, make_limit_suite());
  srunner_add_suite(sr, make_fork_suite());
  srunner_add_suite(sr, make_fixture_suite());
  srunner_add_suite(sr, make_pack_suite());

  setup();
  printf ("Ran %d tests in subordinate suite\n", sub_ntests);
  srunner_run_all (sr, CK_NORMAL);
  cleanup();
  fork_teardown();
  teardown_fixture();
  n = srunner_ntests_failed(sr);
  srunner_free(sr);
  return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Use correct variable for number of tests


Use correct variable for number of tests

git-svn-id: d023f1085a36f7a677188d00334e37d38ffecf51@230 64e312b2-a51f-0410-8e61-82d0ca0eb02a


/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#ifndef COMPUTEREINITIALCONDITIONTHREAD_H
#define COMPUTEREINITIALCONDITIONTHREAD_H

#include "ParallelUniqueId.h"

// libmesh
#include "libmesh/elem_range.h"

class FEProblemBase;

class ComputeInitialConditionThread
{
public:
  ComputeInitialConditionThread(FEProblemBase & fe_problem);
  // Splitting Constructor
  ComputeInitialConditionThread(ComputeInitialConditionThread & x, Threads::split split);

  void operator() (const ConstElemRange & range);
  void join(const ComputeInitialConditionThread & /*y*/);

protected:
  FEProblemBase & _fe_problem;
  THREAD_ID _tid;
};

#endif //COMPUTEINITIALCONDITIONTHREAD_H

/****************************************************************/
/*               DO NOT MODIFY THIS HEADER                      */
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*           (c) 2010 Battelle Energy Alliance, LLC             */
/*                   ALL RIGHTS RESERVED                        */
/*                                                              */
/*          Prepared by Battelle Energy Alliance, LLC           */
/*            Under Contract No. DE-AC07-05ID14517              */
/*            With the U. S. Department of Energy               */
/*                                                              */
/*            See COPYRIGHT for full restrictions               */
/****************************************************************/

#ifndef COMPUTEREINITIALCONDITIONTHREAD_H
#define COMPUTEREINITIALCONDITIONTHREAD_H

#include "MooseTypes.h"

// libmesh
#include "libmesh/elem_range.h"
#include "libmesh/threads.h"

class FEProblemBase;

class ComputeInitialConditionThread
{
public:
  ComputeInitialConditionThread(FEProblemBase & fe_problem);
  // Splitting Constructor
  ComputeInitialConditionThread(ComputeInitialConditionThread & x, Threads::split split);

  void operator() (const ConstElemRange & range);
  void join(const ComputeInitialConditionThread & /*y*/);

protected:
  FEProblemBase & _fe_problem;
  THREAD_ID _tid;
};

#endif //COMPUTEINITIALCONDITIONTHREAD_H

Include headers we need directly

Include headers we need directly


#ifndef LOGDEFER_H
#define LOGDEFER_H

#include "picojson/picojson.h"

class LogDefer {
  public:
    LogDefer(std::function<void (const std::string&)> callback);
    ~LogDefer();
    void add_log(int verbosity, std::string msg);
    void error(std::string msg);
    void warn(std::string msg);
    void info(std::string msg);
    void debug(std::string msg);

  private:
    std::function<void (const std::string &)> callback_;
    struct timeval start_tv_;
    picojson::object o_;
    picojson::array logs_;
    picojson::array timers_;
};

#endif

#pragma once

#include "picojson/picojson.h"

class LogDefer {
  public:
    LogDefer(std::function<void (const std::string&)> callback);
    ~LogDefer();
    void add_log(int verbosity, std::string msg);
    void error(std::string msg);
    void warn(std::string msg);
    void info(std::string msg);
    void debug(std::string msg);

  private:
    std::function<void (const std::string &)> callback_;
    struct timeval start_tv_;
    picojson::object o_;
    picojson::array logs_;
    picojson::array timers_;
};

Use pragma once instead of define hack (thanks Natalia)


#ifdef __cplusplus
extern "C"{
#endif

typedef int vl6180;

#define VL1680_DEFALUT_ADDR 0x29

int vl6180_initialise(int device, int i2cAddr);
int get_distance(vl6180 handle);
void set_scaling(vl6180 handle, int scaling);

///After calling that, you should discrad the handle to talk to the device and re-initialize it
void vl6180_change_addr(vl6180 handle, int newAddr);

//hack:add access to lower_level functions

int read_byte(vl6180 handle, int reg);
void write_byte(vl6180 handle, int reg, char data);
void write_two_bytes(vl6180 handle, int reg, int data);

#ifdef __cplusplus
}
#endif

#ifdef __cplusplus
extern "C"{
#endif

typedef int vl6180;

#define VL1680_DEFALUT_ADDR 0x29

///Initialize a vl6180 sensor on the i2c port
/// \param device The I2C bus to open. e.g. "1" for using /dev/i2c-1
/// \param i2c_addr addres of the device. If you don't know, pass VL1680_DEFALUT_ADDR to it
/// \return handle to the sensor. Keep this variable to talk to the sensor via the library
vl6180 vl6180_initialise(int device, int i2c_addr);

///Change the address of the device. Needed if you have an address conflict (for example: using two of theses sensors on the same design). The handle will also be updated
/// \param handle The handle to the sensor given by vl6180_initialise
/// \param new_addr The new address to use on the i2c bus for this device
void vl6180_change_addr(vl6180 handle, int new_addr);

//TODO some of theses functions doesn't have the vl6180 prefix. udpate them to avoid name clashing

///Return the current distance as readed by the sensor
/// \param handle The handle to the sensor given by vl6180_initialise
/// \return distance in milimeter as an integer
int get_distance(vl6180 handle);

///Set the scalinb mode (read datasheet to seee about the max range vs. precision deal on this sensor)
/// \param handle The handle to the sensor given by vl6180_initialise
/// \param scaling Index of the scaling mode to use
void set_scaling(vl6180 handle, int scaling);

//hack:add access to lower_level functions
int read_byte(vl6180 handle, int reg);
void write_byte(vl6180 handle, int reg, char data);
void write_two_bytes(vl6180 handle, int reg, int data);

#ifdef __cplusplus
}
#endif

Comment the file "doxygen style"

Comment the file "doxygen style"