// GBT Player v3.0.9
//
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2022, Antonio Niño Díaz <antonio_nd@outlook.com>

#include <gba.h>

#include <stdio.h>

#include "gbt_player.h"

extern const uint8_t *template_data[];

int main(int argc, char *argv[])
{
    irqInit();
    irqEnable(IRQ_VBLANK);

    consoleDemoInit();

    iprintf("GBT Player v3.0.9");

    gbt_play(template_data, 5);

    while (1)
    {
        VBlankIntrWait();
        gbt_update();
    }
}

// GBT Player v3.0.9
//
// SPDX-License-Identifier: MIT
//
// Copyright (c) 2022, Antonio Niño Díaz <antonio_nd@outlook.com>

#include <gba.h>

#include "gbt_player.h"

extern const uint8_t *template_data[];

int main(int argc, char *argv[])
{
    irqInit();
    irqEnable(IRQ_VBLANK);

    gbt_play(template_data, 5);

    while (1)
    {
        VBlankIntrWait();
        gbt_update();
    }
}

Stop using console in demo ROM

gba: Stop using console in demo ROM

This makes it easier to analyse the elf map file to look for changes
after modifications to GBT Player.


/*
 * This wraps the dynamic ifdhandler functions. The abstraction will
 * eventually allow multiple card slots in the same terminal.
 *
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 *
 * Copyright (C) 1999
 *  David Corcoran <corcoran@linuxnet.com>
 *
 * $Id$
 */

#ifndef __ifdwrapper_h__
#define __ifdwrapper_h__

#ifdef __cplusplus
extern "C"
{
#endif

	LONG IFDOpenIFD(PREADER_CONTEXT, DWORD);
	LONG IFDCloseIFD(PREADER_CONTEXT);
	LONG IFDPowerICC(PREADER_CONTEXT, DWORD, PUCHAR, PDWORD);
	LONG IFDStatusICC(PREADER_CONTEXT, PDWORD, PDWORD, PUCHAR, PDWORD);
	LONG IFDControl(PREADER_CONTEXT, PUCHAR, DWORD, PUCHAR, PDWORD);
	LONG IFDTransmit(PREADER_CONTEXT, SCARD_IO_HEADER,
		PUCHAR, DWORD, PUCHAR, PDWORD, PSCARD_IO_HEADER);
	LONG IFDSetPTS(PREADER_CONTEXT, DWORD, UCHAR, UCHAR, UCHAR, UCHAR);
	LONG IFDSetCapabilities(PREADER_CONTEXT, DWORD, DWORD, PUCHAR);
	LONG IFDGetCapabilities(PREADER_CONTEXT, DWORD, PDWORD, PUCHAR);

#ifdef __cplusplus
}
#endif

#endif							/* __ifdwrapper_h__ */

/*
 * This wraps the dynamic ifdhandler functions. The abstraction will
 * eventually allow multiple card slots in the same terminal.
 *
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 *
 * Copyright (C) 1999
 *  David Corcoran <corcoran@linuxnet.com>
 *
 * $Id$
 */

#ifndef __ifdwrapper_h__
#define __ifdwrapper_h__

#ifdef __cplusplus
extern "C"
{
#endif

	LONG IFDOpenIFD(PREADER_CONTEXT);
	LONG IFDCloseIFD(PREADER_CONTEXT);
	LONG IFDPowerICC(PREADER_CONTEXT, DWORD, PUCHAR, PDWORD);
	LONG IFDStatusICC(PREADER_CONTEXT, PDWORD, PDWORD, PUCHAR, PDWORD);
	LONG IFDControl(PREADER_CONTEXT, PUCHAR, DWORD, PUCHAR, PDWORD);
	LONG IFDTransmit(PREADER_CONTEXT, SCARD_IO_HEADER,
		PUCHAR, DWORD, PUCHAR, PDWORD, PSCARD_IO_HEADER);
	LONG IFDSetPTS(PREADER_CONTEXT, DWORD, UCHAR, UCHAR, UCHAR, UCHAR);
	LONG IFDSetCapabilities(PREADER_CONTEXT, DWORD, DWORD, PUCHAR);
	LONG IFDGetCapabilities(PREADER_CONTEXT, DWORD, PDWORD, PUCHAR);

#ifdef __cplusplus
}
#endif

#endif							/* __ifdwrapper_h__ */

Modify the prototype of IFDOpenIFD.

Modify the prototype of IFDOpenIFD.

git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@603 0ce88b0d-b2fd-0310-8134-9614164e65ea


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

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

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

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

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

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

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

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

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

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

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

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

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

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

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

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

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

--HG--
branch : HEAD


#define _GNU_SOURCE

#include <stdio.h>
#include <sched.h>
#include <errno.h>
#include <stdint.h>
#include <sys/resource.h>

#include "cpu.h"
#include "../util/taskstats.h"
#include "../util/file_utils.h"

int current_cpus(int pid)
{
    cpu_set_t proc_cpus;
    size_t mask_size = sizeof proc_cpus;

    int ret = sched_getaffinity(pid, mask_size, &proc_cpus);

    if (ret == -1)
        return errno;

    int cpu_affinity = CPU_COUNT(&proc_cpus);

    return cpu_affinity;
}

int nice(int pid)
{
    return getpriority(PRIO_PROCESS, pid);
}

uint64_t get_process_ctxt_switches(int pid)
{
    return task_req(pid, 's');
}

char *get_user_ps_ctxt_switches(char *pid)
{
    char path[MAXPATH];
    snprintf(path, MAXPATH, STATUS, pid);

    return parse_proc(path, SWITCHES);
}

Use parse_proc for context switches if lower perms


#pragma once

#include <mutex>
#include <queue>

// Thread safe implementation of a Queue using a std::queue
template <typename T>
class SafeQueue {
private:
  std::queue<T> m_queue;
  std::mutex m_mutex;
public:
  SafeQueue() {

  }

  SafeQueue(SafeQueue& other) {
    //TODO:
  }

  ~SafeQueue() {

  }

  bool empty() {
    std::unique_lock<std::mutex> lock(m_mutex);
    return m_queue.empty();
  }

  int size() {
    std::unique_lock<std::mutex> lock(m_mutex);
    return m_queue.size();
  }

  void enqueue(T& t) {
    std::unique_lock<std::mutex> lock(m_mutex);
    m_queue.push(t);
  }

  bool dequeue(T& t) {
    std::unique_lock<std::mutex> lock(m_mutex);

    if (m_queue.empty()) {
      return false;
    }
    t = std::move(m_queue.front());

    m_queue.pop();
  }
};

#pragma once

#include <mutex>
#include <queue>

// Thread safe implementation of a Queue using a std::queue
template <typename T>
class SafeQueue {
private:
  std::queue<T> m_queue;
  std::mutex m_mutex;
public:
  SafeQueue() {

  }

  SafeQueue(SafeQueue& other) {
    //TODO:
  }

  ~SafeQueue() {

  }

  bool empty() {
    std::unique_lock<std::mutex> lock(m_mutex);
    return m_queue.empty();
  }

  int size() {
    std::unique_lock<std::mutex> lock(m_mutex);
    return m_queue.size();
  }

  void enqueue(T& t) {
    std::unique_lock<std::mutex> lock(m_mutex);
    m_queue.push(t);
  }

  bool dequeue(T& t) {
    std::unique_lock<std::mutex> lock(m_mutex);

    if (m_queue.empty()) {
      return false;
    }
    t = std::move(m_queue.front());

    m_queue.pop();
    return true;
  }
};

Fix bug in dequeue that caused to return always false


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

#include <memory>
#include <string>
#include <vector>

#include "net/third_party/quiche/src/quic/core/crypto/proof_verifier.h"
#include "net/third_party/quiche/src/quic/core/quic_types.h"

namespace quic {

// A ServerProofVerifier checks the certificate chain presented by a client.
class QUIC_EXPORT_PRIVATE ServerProofVerifier {
 public:
  virtual ~ServerProofVerifier() {}

  // VerifyCertChain checks that |certs| is a valid chain. On success, it
  // returns QUIC_SUCCESS. On failure, it returns QUIC_FAILURE and sets
  // |*error_details| to a description of the problem. In either case it may set
  // |*details|, which the caller takes ownership of.
  //
  // |context| specifies an implementation specific struct (which may be nullptr
  // for some implementations) that provides useful information for the
  // verifier, e.g. logging handles.
  //
  // This function may also return QUIC_PENDING, in which case the
  // ServerProofVerifier will call back, on the original thread, via |callback|
  // when complete. In this case, the ServerProofVerifier will take ownership of
  // |callback|.
  virtual QuicAsyncStatus VerifyCertChain(
      const std::vector<std::string>& certs,
      std::string* error_details,
      std::unique_ptr<ProofVerifierCallback> callback) = 0;
};

}  // namespace quic
#endif  // QUICHE_QUIC_CORE_CRYPTO_SERVER_PROOF_VERIFIER_H_

Add a ServerProofVerifier interface to QUIC.

This is a server-side equivalent of ProofVerifier.  It is used to verify a
client's certificate chain.  It will only be used when the server needs to
request client certificates.

ServerProofVerifier drops the VerifyProof() function (not used in TLS 1.3) and
the |hostname|, |ocsp_response|, and |cert_sct| parameters of VerifyCertChain()
(those aren't really meaningful to a server).

See go/quic-tls-client-certificates for the full design doc and context.

gfe-relnote: no functional changes (only adds an interface).
PiperOrigin-RevId: 291429810
Change-Id: Ifd7deb6e72294b2626572b6555e3b5e2976b286e


#ifndef _GDK_PIXBUF_H_
#define _GDK_PIXBUF_H_

#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_pixbuf.h>

typedef struct {
	int ref_count;
	ArtPixBuf *art_pixbuf;
	void (*unref_func)(void *gdkpixbuf);
} GdkPixBuf;

GdkPixBuf *gdk_pixbuf_load_image (const char *file);
void       gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
void       gdk_pixbuf_ref        (GdkPixBuf *pixbuf);
void       gdk_pixbuf_unref      (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_duplicate  (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_scale	 (GdkPixBuf *pixbuf, gint w, gint h);
GdkPixBuf *gdk_pixbuf_rotate     (GdkPixBuf *pixbuf, gdouble angle);

void	   gdk_pixbuf_destroy    (GdkPixBuf *pixbuf);

#endif /* _GDK_PIXBUF_H_ */

#ifndef _GDK_PIXBUF_H_
#define _GDK_PIXBUF_H_

#include <libart_lgpl/art_misc.h>
#include <libart_lgpl/art_pixbuf.h>
#include <glib.h>

typedef struct {
	int ref_count;
	ArtPixBuf *art_pixbuf;
	void (*unref_func)(void *gdkpixbuf);
} GdkPixBuf;

GdkPixBuf *gdk_pixbuf_load_image (const char *file);
void       gdk_pixbuf_save_image (const char *format_id, const char *file, ...);
void       gdk_pixbuf_ref        (GdkPixBuf *pixbuf);
void       gdk_pixbuf_unref      (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_duplicate  (GdkPixBuf *pixbuf);
GdkPixBuf *gdk_pixbuf_scale	 (GdkPixBuf *pixbuf, gint w, gint h);
GdkPixBuf *gdk_pixbuf_rotate     (GdkPixBuf *pixbuf, gdouble angle);

void	   gdk_pixbuf_destroy    (GdkPixBuf *pixbuf);

#endif /* _GDK_PIXBUF_H_ */

Include glib.h as it uses g* datatypes Added for gnome-config

1999-07-23  Richard Hestilow  <hestgray@ionet.net>

        * src/gdk-pixbuf.h: Include glib.h as it uses g* datatypes
        * gdk_pixbufConf.sh.in: Added for gnome-config
        * Makefile.am:
        * configure.in: Modified to generate gdk_pixbufConf.sh


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

#ifndef ORBIT_BASE_RESULT_H_
#define ORBIT_BASE_RESULT_H_

#include <string>
#include <type_traits>

#include "outcome.hpp"

class ErrorMessage final {
 public:
  ErrorMessage() = default;
  explicit ErrorMessage(std::string message) : message_(std::move(message)) {}

  [[nodiscard]] const std::string& message() const { return message_; }

 private:
  std::string message_;
};

template <typename T, typename E>
using Result = outcome::result<T, E, outcome::policy::terminate>;

template <typename T>
class ErrorMessageOr : public Result<T, ErrorMessage> {
 public:
  using Result<T, ErrorMessage>::Result;

  operator bool() = delete;
  operator bool() const = delete;
};

template <typename T>
struct IsErrorMessageOr : std::false_type {};

template <typename T>
struct IsErrorMessageOr<ErrorMessageOr<T>> : std::true_type {};

#endif  // ORBIT_BASE_RESULT_H_

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

#ifndef ORBIT_BASE_RESULT_H_
#define ORBIT_BASE_RESULT_H_

#include <string>
#include <type_traits>

#include "outcome.hpp"

class [[nodiscard]] ErrorMessage final {
 public:
  ErrorMessage() = default;
  explicit ErrorMessage(std::string message) : message_(std::move(message)) {}

  [[nodiscard]] const std::string& message() const { return message_; }

 private:
  std::string message_;
};

template <typename T, typename E>
using Result = outcome::result<T, E, outcome::policy::terminate>;

template <typename T>
class [[nodiscard]] ErrorMessageOr : public Result<T, ErrorMessage> {
 public:
  using Result<T, ErrorMessage>::Result;

  operator bool() = delete;
  operator bool() const = delete;
};

template <typename T>
struct IsErrorMessageOr : std::false_type {};

template <typename T>
struct IsErrorMessageOr<ErrorMessageOr<T>> : std::true_type {};

#endif  // ORBIT_BASE_RESULT_H_

Add nodiscard to ErrorMessage and ErrorMessageOr

Test: builds


/*
 * Challenger 1P Hello World Program for cc65.
 */

#include <conio.h>

int main(void)
{
    static const char hello_world[] =
            "Hello world!\r\ncc65 for Challenger 1P";

    unsigned int i;

    clrscr();

    gotoxy(0, 0);

    cputs(hello_world);

    gotoxy(0, 4);

    for (i = 0; i < 256; i += 1) {
        if (i != '\n' && i != '\r') {
            cputc((unsigned char ) i);
        }
    }

    cputsxy(0, 14, "cputsxy\r\n");

    cprintf("cprintf '%s' %d %d\r\n", "string", (int) wherex(), (int) wherey());
    cputs("now type something:\r\n");

    while (1) {
        char c = cgetc();
        cputc(c);
    }

    return 0;
}

/*
 * Challenger 1P Hello World Program for cc65.
 */

#include <conio.h>

int main(void)
{
    static const char hello_world[] =
            "Hello world!\r\ncc65 for Challenger 1P";

    unsigned int i;

    clrscr();

    /* TODO this should be implicitly done in clrscr() */
    gotoxy(0, 0);

    cputs(hello_world);

    gotoxy(0, 4);

    for (i = 0; i < 0x20; i += 1) {
        if (i != '\n' && i != '\r') {
            cputc((unsigned char ) i);
        }
    }

    cputsxy(0, 8, "cputsxy\r\n");

    cprintf("cprintf '%s' %d %d\r\n", "string", (int) wherex(), (int) wherey());
    cputs("now type something (vi keys for positioning, "
            "'A' cursor on, 'B' cursor off):\r\n");

    /* cursor on */
    cursor(1);

    while (1) {
        unsigned char const xpos = wherex();
        unsigned char const ypos = wherey();

        char const c = cgetc();

        /* Test cursor on/off and cursor positioning */
        switch (c) {
            case 'A':
                cursor(1);
                break;
            case 'B':
                cursor(0);
                break;
            case 'H':
                if (xpos > 0) {
                    gotox(xpos - 1);
                }
                break;
            case 'L':
                if (xpos < 24) {
                    gotox(xpos + 1);
                }
                break;
            case 'K':
                if (ypos > 0) {
                    gotoy(ypos - 1);
                }
                break;
            case 'J':
                if (ypos < 24) {
                    gotoy(ypos + 1);
                }
                break;
            default:
                cputc(c);
                break;
        }
    }

    return 0;
}

Test new cursor functionality now implemented in the c1p runtime library.


/*! \file TextureHandle.h
 *  \author Jared Hoberock
 *  \brief Defines the interface to an opaque
 *         pointer type for Textures.
 */

#pragma once

#include <string>

typedef unsigned int TextureHandle;

struct TextureParameter
{
  inline TextureParameter(void)
    :mHandle(0),mAlias(""){}

  inline TextureParameter(const std::string &alias)
    :mHandle(0),mAlias(alias){}

  inline TextureParameter(const TextureHandle &h)
    :mHandle(h),mAlias(""){}

  operator TextureHandle (void) const {return mHandle;}

  TextureHandle mHandle;

  // filename or other alias for a Texture to use during shading
  // if this is not '' during preprocess, the texture referred to
  // by this alias will be loaded and bound
  std::string mAlias;
}; // end TextureParameter

/*! \file TextureHandle.h
 *  \author Jared Hoberock
 *  \brief Defines the interface to an opaque
 *         pointer type for Textures.
 */

#pragma once

#include <string>

typedef unsigned int TextureHandle;

struct TextureParameter
{
  inline TextureParameter(void)
    :mHandle(0),mAlias(""){}

  inline TextureParameter(const std::string &alias)
    :mHandle(0),mAlias(alias){}

  inline TextureParameter(const TextureHandle &h)
    :mHandle(h),mAlias(""){}

  inline operator TextureHandle (void) const {return mHandle;}

  TextureHandle mHandle;

  // filename or other alias for a Texture to use during shading
  // if this is not '' during preprocess, the texture referred to
  // by this alias will be loaded and bound
  std::string mAlias;
}; // end TextureParameter

Make the cast operator inline for use with CUDA

git-svn-id: eeeef91d721e48f02083ec31b1220ddf564a51e4@1671 3bb10773-34f4-0310-b88c-ec9d511ba0d9


/* Copyright (C) 2011-2012 Zeex
 *
 * 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.
 */

#include <sampgdk/config.h>
#include <sampgdk/a_samp.h>
#include <sampgdk/export.h>

#include "fakeamx.h"
#include "native.h"
#include "timer.h"

#include "generated/a_samp-impl.c"

SAMPGDK_NATIVE(int, SetTimer(int interval, bool repeat, TimerCallback callback, void *param)) {
	int timerid;

	if (timer_set(&timerid, interval, repeat, (timer_callback)callback, param) >= 0) {
		return timerid;
	}
	return -1;
}

SAMPGDK_NATIVE(bool, KillTimer(int timerid)) {
	return timer_kill(timerid) >= 0;
}

/* Copyright (C) 2011-2012 Zeex
 *
 * 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.
 */

#include <sampgdk/config.h>
#include <sampgdk/a_samp.h>
#include <sampgdk/export.h>

#include "fakeamx.h"
#include "native.h"
#include "timer.h"

#include "generated/a_samp-impl.c"

SAMPGDK_NATIVE(int, SetTimer(int interval, bool repeat, TimerCallback callback, void *param)) {
	int timerid;

	if (timer_set(&timerid, interval, repeat, (timer_callback)callback, param) >= 0) {
		return timerid + 1;
	}

	return 0;
}

SAMPGDK_NATIVE(bool, KillTimer(int timerid)) {
	return timer_kill(timerid - 1) >= 0;
}

Make timer ID's start with 1

Make timer ID's start with 1


/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkDump_DEFINED
#define SkDump_DEFINED

#include "SkDisplayable.h"
#include "SkMemberInfo.h"

class SkAnimateMaker;
class SkString;

class SkDump : public SkDisplayable {
    DECLARE_MEMBER_INFO(Dump);
#ifdef SK_DUMP_ENABLED
    SkDump();
    bool enable(SkAnimateMaker & ) override;
    bool evaluate(SkAnimateMaker &);
    bool hasEnable() const override;
    static void GetEnumString(SkDisplayTypes , int index, SkString* result);
    SkBool displayList;
    SkBool eventList;
    SkBool events;
    SkString name;
    SkBool groups;
    SkBool posts;
    SkString script;
#else
    virtual bool enable(SkAnimateMaker & );
    virtual bool hasEnable() const;
    virtual bool setProperty(int index, SkScriptValue& );
#endif
};

#endif // SkDump_DEFINED

/*
 * Copyright 2006 The Android Open Source Project
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkDump_DEFINED
#define SkDump_DEFINED

#include "SkDisplayable.h"
#include "SkMemberInfo.h"

class SkAnimateMaker;
class SkString;

class SkDump : public SkDisplayable {
    DECLARE_MEMBER_INFO(Dump);
#ifdef SK_DUMP_ENABLED
    SkDump();
    bool enable(SkAnimateMaker & ) override;
    bool evaluate(SkAnimateMaker &);
    bool hasEnable() const override;
    static void GetEnumString(SkDisplayTypes , int index, SkString* result);
    SkBool displayList;
    SkBool eventList;
    SkBool events;
    SkString name;
    SkBool groups;
    SkBool posts;
    SkString script;
#else
    bool enable(SkAnimateMaker & ) override;
    bool hasEnable() const override;
    bool setProperty(int index, SkScriptValue& ) override;
#endif
};

#endif // SkDump_DEFINED

Fix a stray -Winconsistent-missing-override warning.

TBR=

BUG=skia:

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


// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (C) 2012-2016, Ryan P. Wilson
//
//      Authority FX, Inc.
//      www.authorityfx.com

#ifndef AFX_MSVC_HACKS_H_
#define AFX_MSVC_HACKS_H_

// MSVC10 does not have C99 support. fmin and fmax functions are not available
#ifdef _WIN32
  float fminf(float a, float b) {
    return std::min(a, b);
  }
  float fmaxf(float a, float b) {
    return std::max(a, b);
  }
#endif

#endif  // AFX_MSVC_HACKS_H_

Add file for msvc compile

Add file for msvc compile


#ifndef OCELOT2_SCANNER_H
#define OCELOT2_SCANNER_H

void get_symbol();

#endif // OCELOT2_SCANNER_H

#ifndef OCELOT2_SCANNER_H
#define OCELOT2_SCANNER_H

/**
 * Tokens
 */
int T_EOF;

int current_symbol;

void scanner_init();
void scanner_token_init();
void scanner_get_symbol();

#endif // OCELOT2_SCANNER_H

Add first token, current_symbol and function prototypes


#ifndef __DEBUG_H
#define __DEBUG_H

#ifdef DEBUG
extern bool debug;
extern bool debug_z;

#define DBG if (debug)
#define MSG(x) DBG msg x
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define DBG if (0)
#define MSG(x)
#define PRECONDITION(x) // nothing
#endif

#endif

#ifndef __DEBUG_H
#define __DEBUG_H

#ifdef DEBUG
extern bool debug;
extern bool debug_z;

#define DBG if (debug)
#define MSG(x) DBG msg x
#else
#define DBG if (0)
#define MSG(x)
#endif

#if defined(DEBUG) || defined(PRECON)
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define PRECONDITION(x) // nothing
#endif

#endif

Make PRECONDITION usable in isolation by compile time define PRECON.


#include <stdio.h>
#include <stdlib.h>
#define MARK_SIZE 8

int read_marks(float marks[])
{
    char mark[MARK_SIZE];
    int c = 0;

    for (int i = 0; i < 4; i++) {
        c += 1;
        printf("mark[%d]: ", i+1);
        fgets(mark, sizeof(mark), stdin);
        marks[i] = strtol(mark, NULL, 0);
    }

    return c;
}

float calculate_average(float marks[], int size)
{
    float sum = 0;

    for (int i = 0; i < 4; i++)
        sum += marks[i];

    return sum / size;
}

#include <stdio.h>
#include <stdlib.h>
#define MARK_SIZE 8

int read_marks(float marks[])
{
    char mark[MARK_SIZE];
    int c = 0;

    for (int i = 0; i < 4; i++) {
        c += 1;
        printf("mark[%d]: ", i+1);
        fgets(mark, sizeof(mark), stdin);
        marks[i] = strtol(mark, NULL, 0);
    }

    return c;
}

float calculate_average(float marks[], int size)
{
    float sum = 0;

    for (int i = 0; i < size; i++)
        sum += marks[i];

    return sum / size;
}

Use the size of the array passed in

Use the size of the array passed in

* It'll work for any size array


/*
 * Mesa 3-D graphics library
 * Version:  3.5
 *
 * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, 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
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef API_LOOPBACK_H
#define API_LOOPBACK_H

#include "main/compiler.h"
#include "main/mfeatures.h"

struct _glapi_table;

extern void
_mesa_loopback_init_api_table(const struct gl_context *ctx,
                              struct _glapi_table *dest);

#endif /* API_LOOPBACK_H */

/*
 * Mesa 3-D graphics library
 * Version:  3.5
 *
 * Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the "Software"),
 * to deal in the Software without restriction, including without limitation
 * the rights to use, copy, modify, merge, publish, distribute, 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
 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#ifndef API_LOOPBACK_H
#define API_LOOPBACK_H

#include "main/compiler.h"
#include "main/mfeatures.h"

struct _glapi_table;
struct gl_context;

extern void
_mesa_loopback_init_api_table(const struct gl_context *ctx,
                              struct _glapi_table *dest);

#endif /* API_LOOPBACK_H */

main: Fix warning ('struct gl_context' declared inside parameter list).

This eliminates a warning in GCC 4.7.1.

Reviewed-by: Brian Paul <3cb4e1df5ec4da2c7c4af7c52cec8cf340a55a10@vmware.com>
Reviewed-by: Jordan Justen <a79006884ba9cf5f4f7fcbb92a15b208780d8c97@intel.com>
Reviewed-by: Ian Romanick <2b237cafb16dc45038e85df6c85e74e6d899eba9@intel.com>


// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null

typedef int __darwin_wchar_t;
typedef __darwin_wchar_t wchar_t;
typedef signed short SQLSMALLINT;
typedef SQLSMALLINT SQLRETURN;
typedef enum
  {
    en_sqlstat_total
  }
  sqlerrmsg_t;
SQLRETURN _iodbcdm_sqlerror( )
{
  wchar_t _sqlState[6] = { L"\0" };
}

// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null

#include <stddef.h>
signed short _iodbcdm_sqlerror( )
{
  wchar_t _sqlState[6] = { L"\0" };
}

Fix test so it works on systems where wchar_t != int.

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


/**
 * @author Adam Grandquist
 */

#include "ReQL-ast.h"

#ifndef _REQL_H
#define _REQL_H

struct _ReQL_Conn_s {
  int socket;
  int error;
  char *buf;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;

struct _ReQL_Cur_s {
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;

int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port);
int _reql_close_conn(_ReQL_Conn_t *conn);

_ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs);
void _reql_next(_ReQL_Cur_t *cur);
void _reql_close_cur(_ReQL_Cur_t *cur);

#endif

/**
 * @author Adam Grandquist
 */

#include "ReQL-ast.h"

#ifndef _REQL_H
#define _REQL_H

struct _ReQL_Conn_s {
  int socket;
  int error;
  char *buf;
  unsigned int max_token;
  struct _ReQL_Cur_s **cursor;
};
typedef struct _ReQL_Conn_s _ReQL_Conn_t;

struct _ReQL_Cur_s {
};
typedef struct _ReQL_Cur_s _ReQL_Cur_t;

int _reql_connect(_ReQL_Conn_t *conn, unsigned char host_len, char *host, unsigned char port);
int _reql_close_conn(_ReQL_Conn_t *conn);

_ReQL_Cur_t *_reql_run(_ReQL_Op_t *query, _ReQL_Conn_t *conn, _ReQL_Op_t *kwargs);
void _reql_next(_ReQL_Cur_t *cur);
void _reql_close_cur(_ReQL_Cur_t *cur);

#endif

Add token counter and cursor array to connections.


#ifndef BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#define BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_

#include "calculator/fourier/fourier_transform_i.h"

namespace bart {

namespace calculator {

namespace fourier {

class FourierTransformFFTW : public FourierTransformI {
 public:
  FourierTransformFFTW(const int n_samples)
  : n_samples_(n_samples) {};
  int n_samples() const { return n_samples_; }
 private:
  const int n_samples_{0};
};

} // namespace fourier

} // namespace calculator

} // namespace bart

#endif //BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_

#ifndef BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_
#define BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_

#include "calculator/fourier/fourier_transform_i.h"

namespace bart {

namespace calculator {

namespace fourier {

class FourierTransformFFTW : public FourierTransformI {
 public:
  FourierTransformFFTW(const int n_samples);
  int n_samples() const { return n_samples_; }
 private:
  const int n_samples_;
};

} // namespace fourier

} // namespace calculator

} // namespace bart

#endif //BART_SRC_CALCULATOR_FOURIER_FOURIER_TRANSFORM_FFTW_H_

Put constructor for FourierTransformFFTW in cc file.


#ifndef __libcpu_timings_h
#define __libcpu_timings_h

#ifdef __MACH__
#include <mach/mach_time.h>

#define abs_time() mach_absolute_time()
#endif

#ifdef sun
#include <sys/time.h>

#define abs_time() gethrtime()
#endif

#ifdef linux
#warning High precission timing currently n/a on Linux

// HACK
#define abs_time() 0
#endif

#endif  /* !__libcpu_timings_h */

#ifndef __libcpu_timings_h
#define __libcpu_timings_h

#ifdef __MACH__
#include <mach/mach_time.h>

#define abs_time() mach_absolute_time()
#endif

#ifdef sun
#include <sys/time.h>

#define abs_time() gethrtime()
#endif

#ifdef linux
#warning High precission timing currently n/a on Linux

// HACK
#define abs_time() 0
#endif

#ifdef _WIN32
typedef unsigned long       DWORD;
#define WINAPI      __stdcall
extern "C" DWORD WINAPI GetTickCount(void);
#define abs_time() GetTickCount()
#endif

#endif  /* !__libcpu_timings_h */

Make abs_time() use GetTickCount() on Windows


#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class AliQuarkoniaAcceptance+;
#pragma link C++ class AliQuarkoniaEfficiency+;

#pragma link C++ class AliD0toKpi+;
#pragma link C++ class AliD0toKpiAnalysis+;
#pragma link C++ class AliBtoJPSItoEle+;
#pragma link C++ class AliBtoJPSItoEleAnalysis+;

#pragma link C++ class AliAODRecoDecayHF+;
#pragma link C++ class AliAODRecoDecayHF2Prong+;
#pragma link C++ class AliAODRecoDecayHF3Prong+;
#pragma link C++ class AliAODRecoDecayHF4Prong+;
#pragma link C++ class AliAnalysisVertexingHF+;
#pragma link C++ class AliAnalysisTaskVertexingHF+;

#pragma link C++ class AliAODDimuon+;
#pragma link C++ class AliAODEventInfo+;
#pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+;
#pragma link C++ class AliAnalysisTaskSingleMu+;

#endif

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class AliQuarkoniaAcceptance+;
#pragma link C++ class AliQuarkoniaEfficiency+;

#pragma link C++ class AliAODRecoDecayHF+;
#pragma link C++ class AliAODRecoDecayHF2Prong+;
#pragma link C++ class AliAODRecoDecayHF3Prong+;
#pragma link C++ class AliAODRecoDecayHF4Prong+;
#pragma link C++ class AliAnalysisVertexingHF+;
#pragma link C++ class AliAnalysisTaskVertexingHF+;

#pragma link C++ class AliAODDimuon+;
#pragma link C++ class AliAODEventInfo+;
#pragma link C++ class AliAnalysisTaskMuonAODfromGeneral+;
#pragma link C++ class AliAnalysisTaskSingleMu+;

#endif

Move AliD0toKpi* and AliBtoJPSI* from libPWG3base to libPWG3 (Andrea)


/**
  * Touhou Community Reliant Automatic Patcher
  * Main DLL
  *
  * ----
  *
  * Globals, compile-time constants and runconfig abstractions.
  */

#include "thcrap.h"

CRITICAL_SECTION cs_file_access;
json_t* run_cfg = NULL;

const char* PROJECT_NAME(void)
{
	return "Touhou Community Reliant Automatic Patcher";
}
const char* PROJECT_NAME_SHORT(void)
{
	return "thcrap";
}
const DWORD PROJECT_VERSION(void)
{
	return 0x20131025;
}
const char* PROJECT_VERSION_STRING(void)
{
	static char ver_str[11] = {0};
	if(!ver_str[0]) {
		str_hexdate_format(ver_str, PROJECT_VERSION());
	}
	return ver_str;
}
json_t* runconfig_get(void)
{
	return run_cfg;
}
void runconfig_set(json_t *new_run_cfg)
{
	run_cfg = new_run_cfg;
}

void* runconfig_func_get(const char *name)
{
	json_t *funcs = json_object_get(run_cfg, "funcs");
	return (void*)json_object_get_hex(funcs, name);
}

/**
  * Touhou Community Reliant Automatic Patcher
  * Main DLL
  *
  * ----
  *
  * Globals, compile-time constants and runconfig abstractions.
  */

#include "thcrap.h"

CRITICAL_SECTION cs_file_access;
json_t* run_cfg = NULL;

const char* PROJECT_NAME(void)
{
	return "Touhou Community Reliant Automatic Patcher";
}
const char* PROJECT_NAME_SHORT(void)
{
	return "thcrap";
}
const DWORD PROJECT_VERSION(void)
{
	return 0x20131025;
}
const char* PROJECT_VERSION_STRING(void)
{
	static char ver_str[11] = {0};
	if(!ver_str[0]) {
		str_hexdate_format(ver_str, PROJECT_VERSION());
	}
	return ver_str;
}
json_t* runconfig_get(void)
{
	return run_cfg;
}
void runconfig_set(json_t *new_run_cfg)
{
	run_cfg = new_run_cfg;
	json_incref(run_cfg);
}

void* runconfig_func_get(const char *name)
{
	json_t *funcs = json_object_get(run_cfg, "funcs");
	return (void*)json_object_get_hex(funcs, name);
}

runconfig_set(): Increment the run configuration's reference counter.

Fixes bug #41 (https://bitbucket.org/nmlgc/thpatch-bugs/issue/41).


/*
 * (C) 2001 by Matthias Andree
 */

/*
 * This file (leafnode-version.c) is public domain. It comes without and
 * express or implied warranties. Do with this file whatever you wish, but
 * don't remove the disclaimer.
 */

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

#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif

#include "config.h"

int
main(void)
{
    static char env_path[] = "PATH=/bin:/usr/bin";
    /* ------------------------------------------------ */
    /* *** IMPORTANT ***
     *
     * external tools depend on the first line of this output, which is
     * in the fixed format
     * version: leafnode-2.3.4...
     */
    fputs("version: leafnode-", stdout);
    puts(version);
    /* changable parts below :-) */
    fputs("current machine: ", stdout);
    fflush(stdout);
    putenv(env_path);
    if (system("uname -a"))
	puts(" (error)");
    fputs("bindir: ", stdout);
    puts(bindir);
    fputs("sysconfdir: ", stdout);
    puts(sysconfdir);
    fputs("spooldir: ", stdout);
    puts(spooldir);
    fputs("lockfile: ", stdout);
    puts(lockfile);
#ifdef HAVE_IPV6
    puts("IPv6: yes");
#else
    puts("IPv6: no");
#endif
    fputs("default MTA: ", stdout);
    puts(DEFAULTMTA);
    exit(0);
}

/*
 * (C) 2001 by Matthias Andree
 */

/*
 * This file (leafnode-version.c) is public domain. It comes without and
 * express or implied warranties. Do with this file whatever you wish, but
 * don't remove the disclaimer.
 */

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

#ifdef WITH_DMALLOC
#include <dmalloc.h>
#endif

#include "config.h"

int
main(void)
{
    static char env_path[] = "PATH=/bin:/usr/bin";
    /* ------------------------------------------------ */
    /* *** IMPORTANT ***
     *
     * external tools depend on the first line of this output, which is
     * in the fixed format
     * version: leafnode-2.3.4...
     */
    fputs("version: leafnode-", stdout);
    puts(version);
    /* changable parts below :-) */
    fputs("current machine: ", stdout);
    fflush(stdout);
    putenv(env_path);
    if (system("uname -a"))
	puts(" (error)");
    fputs("bindir: ", stdout);
    puts(bindir);
    fputs("sysconfdir: ", stdout);
    puts(sysconfdir);
    fputs("default spooldir: ", stdout);
    puts(def_spooldir);
#ifdef HAVE_IPV6
    puts("IPv6: yes");
#else
    puts("IPv6: no");
#endif
    fputs("default MTA: ", stdout);
    puts(DEFAULTMTA);
    exit(0);
}

Fix up the spooldir/lockfile changes that caused a segfault.


#include "Arduino.h"

class MotorShield
{
  public:
    MotorShield(uint8_t speedPinLeft, uint8_t dirPinLeft,
        uint8_t speedPinRight, uint8_t dirPinRight);
    void init();
    void forward();
    void backward();
    void stop();
    void fullSpeed();
    void stopLeft();
    void stopRight();
  private:
    int speedPinLeft,
        dirPinLeft,
        speedPinRight,
        dirPinRight,
        maxSpeed,
        minSpeed;
};

#include "Arduino.h"

class MotorShield
{
  public:
    MotorShield(uint8_t speedPinLeft, uint8_t dirPinLeft,
        uint8_t speedPinRight, uint8_t dirPinRight);
    void init();
    void forward();
    void backward();
    void stop();
    void fullSpeed();
    void stopLeft();
    void stopRight();
  private:
    uint8_t speedPinLeft,
            dirPinLeft,
            speedPinRight,
            dirPinRight,
            maxSpeed,
            minSpeed;
};

Change var types to the same type that constructor expects


/*
  Additional tools for Minizip
  Code: Xavier Roche '2004
  License: Same as ZLIB (www.gzip.org)
*/

#ifndef _zip_tools_H
#define _zip_tools_H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _ZLIB_H
#include "zlib.h"
#endif

#include "unzip.h"

/* Repair a ZIP file (missing central directory)
   file: file to recover
   fileOut: output file after recovery
   fileOutTmp: temporary file name used for recovery
*/
extern int ZEXPORT unzRepair(const char* file,
                             const char* fileOut,
                             const char* fileOutTmp,
                             uLong* nRecovered,
                             uLong* bytesRecovered);

#endif

/*
  Additional tools for Minizip
  Code: Xavier Roche '2004
  License: Same as ZLIB (www.gzip.org)
*/

#ifndef _zip_tools_H
#define _zip_tools_H

#ifdef __cplusplus
extern "C" {
#endif

#ifndef _ZLIB_H
#include "zlib.h"
#endif

#include "unzip.h"

/* Repair a ZIP file (missing central directory)
   file: file to recover
   fileOut: output file after recovery
   fileOutTmp: temporary file name used for recovery
*/
extern int ZEXPORT unzRepair(const char* file,
                             const char* fileOut,
                             const char* fileOutTmp,
                             uLong* nRecovered,
                             uLong* bytesRecovered);

#ifdef __cplusplus
}
#endif

#endif

Fix bug when compiling minizip with C++ [Vollant].


/**
 *  \file
 *  \remark This file is part of VITA.
 *
 *  \copyright Copyright (C) 2018 EOS di Manlio Morini.
 *
 *  \license
 *  This Source Code Form is subject to the terms of the Mozilla Public
 *  License, v. 2.0. If a copy of the MPL was not distributed with this file,
 *  You can obtain one at http://mozilla.org/MPL/2.0/
 */

#if !defined(VITA_EXCEPTIONS_H)
#define      VITA_EXCEPTIONS_H

#include <stdexcept>

namespace vita
{

///
/// Groups the custom exceptions used in Vita.
///
/// There is a separate header because one can ignore custom exception types
/// (since they are descendants of `std::exception`) in general case, but can
/// alss explicitly include the header and deal with custom exceptions if
/// necessary.
///
namespace exception
{

class data_format : public std::runtime_error
{ using std::runtime_error::runtime_error; };
class insufficient_data : public std::logic_error
{ using std::logic_error::logic_error; };

}  // namespace exception

}  // namespace vita

#endif  // include guard

/**
 *  \file
 *  \remark This file is part of VITA.
 *
 *  \copyright Copyright (C) 2018 EOS di Manlio Morini.
 *
 *  \license
 *  This Source Code Form is subject to the terms of the Mozilla Public
 *  License, v. 2.0. If a copy of the MPL was not distributed with this file,
 *  You can obtain one at http://mozilla.org/MPL/2.0/
 */

#if !defined(VITA_EXCEPTIONS_H)
#define      VITA_EXCEPTIONS_H

#include <stdexcept>

namespace vita
{

///
/// Groups the custom exceptions used in Vita.
///
/// There is a separate header because one can ignore custom exception types
/// (since they are descendants of `std::exception`) in general case, but can
/// also explicitly include the header and deal with custom exceptions if
/// necessary.
///
namespace exception
{

class data_format : public std::runtime_error
{ using std::runtime_error::runtime_error; };
class insufficient_data : public std::logic_error
{ using std::logic_error::logic_error; };

}  // namespace exception

}  // namespace vita

#endif  // include guard

Fix a typo in remark

[DOC] Fix a typo in remark


/* Unix sqConfig.h -- platform identification and configuration */

/* This file has been superseded by autoconf for Unix variants. */

#include "config.h"

#ifndef UNIX
# define UNIX
#endif

#if !defined(LSB_FIRST)
#error  "LSB_FIRST is undefined. Used for setting platform endianesness!"
#endif

#if LSB_FIRST
# define VMBIGENDIAN 0
#else
# define VMBIGENDIAN 1
#endif

#if defined(__GNUC__)
/* Define the "don't generate functions with register parameters" attribute
 * for x86 and similar.  Do so for debugging; gdb typically can't call static
 * functions that have been optimized to use register arguments.
 */
# if defined(_M_I386) || defined(_X86_) || defined(i386) || defined(i486) || defined(i586) || defined(i686) || defined(__i386__) || defined(__386__) || defined(X86) || defined(I386)
/*#	define PlatformNoDbgRegParms __attribute__ ((regparm (0)))*/
# endif
# define NeverInline __attribute__ ((noinline))
#endif

#if defined( __clang__)
# define NeverInline __attribute__ ((noinline))
#endif

/* Make the gcc/clang asm keyword available, even when running
 * in standard C mode.
 */
#define asm __asm__

Make the gcc/clang asm keyword available, even when running in standard C mode.


#ifndef _SERHEX_H_
#define _SERHEX_H_

#include <termios.h> // POSIX terminal control definitions

int configure_port(int fd, speed_t st);
int open_port(char *port);
int send_cmd(char *, uint8_t *, int, uint8_t *);
int send_cmd_with_delay(char *, uint8_t *, int, uint8_t *, int);

#endif /* _SERHEX_H_ */

#ifndef _SERHEX_H_
#define _SERHEX_H_

#include <termios.h> // POSIX terminal control definitions
#include <stdint.h>

int configure_port(int fd, speed_t st);
int open_port(char *port);
int send_cmd(char *, uint8_t *, int, uint8_t *);
int send_cmd_with_delay(char *, uint8_t *, int, uint8_t *, int);

#endif /* _SERHEX_H_ */

Fix to compile on Debian

Fix to compile on Debian

Debian fails to compile because `serhex_api.h` wasn't using <stdint.h>


// R UN: %llvmgcc %s -S -O0 -o - | FileCheck %s
// Radar 9156771
typedef struct RGBColor {
  unsigned short red;
  unsigned short green;
  unsigned short blue;
} RGBColor;

RGBColor func();

RGBColor X;
void foo() {
//CHECK: store i48
  X = func();
}

// RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s
// REQUIRES: disabled
// Radar 9156771
typedef struct RGBColor {
  unsigned short red;
  unsigned short green;
  unsigned short blue;
} RGBColor;

RGBColor func();

RGBColor X;
void foo() {
//CHECK: store i48
  X = func();
}

Disable test in a way that keeps lit happy.

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


/*
 * Copyright (c) 2017 Lech Kulina
 *
 * This file is part of the Realms Of Steel.
 * For conditions of distribution and use, see copyright details in the LICENSE file.
 */
#ifndef ROS_RESOURCE_CACHE_H
#define ROS_RESOURCE_CACHE_H

#include <core/Common.h>
#include <core/Environment.h>
#include <resources/ArchiveFile.h>
#include <resources/ResourceLoader.h>

namespace ros {
    class ROS_API ResourceCache : public boost::noncopyable {
        public:
            virtual ~ResourceCache() {}

            virtual bool init(const PropertyTree& config);
            virtual void uninit();

            virtual BufferPtr acquireBuffer(const std::string& name) =0;
            virtual void releaseBuffer(BufferPtr buffer) =0;

            const std::string& getName() const { return name; }
            ArchiveFileList& getArchives() { return archives; }
            ResourceLoaderList& getLoaders() { return loaders; }

        protected:
            BufferPtr loadBuffer(const std::string& name);

        private:
            std::string name;
            ArchiveFileList archives;
            ResourceLoaderList loaders;

            ArchiveEntryPtr findEntry(const std::string& name);
            ResourceLoaderPtr findLoader(const std::string& name);
    };

    typedef boost::shared_ptr<ResourceCache> ResourceCachePtr;
    typedef Factory<ResourceCache> ResourceCacheFactory;
    typedef std::list<ResourceCachePtr> ResourceCacheList;
    typedef std::map<std::string, ResourceCachePtr> ResourceCacheMap;
}

#endif // ROS_RESOURCE_CACHE_H

/*
 * Copyright (c) 2017 Lech Kulina
 *
 * This file is part of the Realms Of Steel.
 * For conditions of distribution and use, see copyright details in the LICENSE file.
 */
#ifndef ROS_RESOURCE_CACHE_H
#define ROS_RESOURCE_CACHE_H

#include <core/Common.h>
#include <core/Environment.h>
#include <resources/ArchiveFile.h>
#include <resources/ResourceLoader.h>

namespace ros {
    class ROS_API ResourceCache : public boost::noncopyable {
        public:
            virtual ~ResourceCache() {}

            virtual bool init(const PropertyTree& config);
            virtual void uninit();

            virtual BufferPtr acquireBuffer(const std::string& name) =0;
            virtual void releaseBuffer(BufferPtr buffer) =0;
            virtual U32 computeUsedSize() const =0;

            const std::string& getName() const { return name; }
            ArchiveFileList& getArchives() { return archives; }
            ResourceLoaderList& getLoaders() { return loaders; }

        protected:
            BufferPtr loadBuffer(const std::string& name);

        private:
            std::string name;
            ArchiveFileList archives;
            ResourceLoaderList loaders;

            ArchiveEntryPtr findEntry(const std::string& name);
            ResourceLoaderPtr findLoader(const std::string& name);
    };

    typedef boost::shared_ptr<ResourceCache> ResourceCachePtr;
    typedef Factory<ResourceCache> ResourceCacheFactory;
    typedef std::list<ResourceCachePtr> ResourceCacheList;
    typedef std::map<std::string, ResourceCachePtr> ResourceCacheMap;
}

#endif // ROS_RESOURCE_CACHE_H

Add support for computing currently used size in resource caches


#pragma once

#include <util/raii_helper.h>

namespace shk {
namespace detail {

void closeFd(int fd);

}

using FileDescriptor = RAIIHelper<int, void, detail::closeFd, -1>;

}  // namespace shk

#pragma once

#include <util/raii_helper.h>

namespace shk {
namespace detail {

void closeFd(int fd);

}  // namespace detail

using FileDescriptor = RAIIHelper<int, void, detail::closeFd, -1>;

}  // namespace shk

Add missing namespace closing comment

Style: Add missing namespace closing comment


#pragma once

#include "util/none.h"

#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#endif

#pragma once

#include "util/none.h"

#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#define IF_SDK_3_ELSE(sdk3, other) sdk3
#define IF_SDK_2_ELSE(sdk2, other) other
#define SDK_3_USAGE
#define SDK_2_USAGE __attribute__((unused))
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#define IF_SDK_3_ELSE(sdk3, other) other
#define IF_SDK_2_ELSE(sdk2, other) sdk2
#define SDK_3_USAGE __attribute__((unused))
#define SDK_2_USAGE
#endif

Add SDK IF_ELSE and USAGE macros

Add SDK IF_ELSE and USAGE macros


#include "handlers.h"

void warning(void *ctx, const char *msg, ...)
{
	va_list args;

	va_start(args, msg);
	fprintf(stdout, "SAX.warning()\n");
	vfprintf(stdout, msg, args);
	va_end(args);
}

void error(void *ctx, const char *msg, ...)
{
	va_list args;

	va_start(args, msg);
	fprintf(stdout, "SAX.error()\n");
	vfprintf(stdout, msg, args);
	va_end(args);
}

void fatal_error(void *ctx, const char *msg, ...)
{
	va_list args;

	va_start(args, msg);
	fprintf(stdout, "SAX.fatal_error()\n");
	vfprintf(stdout, msg, args);
	va_end(args);
}

void say(void *ctx, const char *tag, const char *msg)
{
	fprintf(stdout, "[%s] %s\n", tag, msg);
}

Add overridable default message serializer


#ifndef PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_H

#define PHP_FAST_ASSERT_VERSION "0.1"
#define PHP_FAST_ASSERT_EXTNAME "fast_assert"

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

extern "C" {
#include "php.h"
}

typedef struct _fast_assert_globals {
	// global object handles pointing to the 3 commonly used assert objects
	zend_object_handle invalid_arg_assert_handle;
	zend_object_handle unexpected_val_assert_handle;
	zend_object_handle logic_exception_assert_handle;
} fast_assert_globals;

#ifdef ZTS
#define AssertGlobals(v) TSRMG(fa_globals_id, fast_assert_globals *, v)
extern int fa_globals_id;
#else
#define AssertGlobals(v) (fa_globals.v)
extern fast_assert_globals fa_globals;
#endif /* ZTS */

extern zend_module_entry fast_assert_module_entry;
#define phpext_fast_assert_ptr &fast_assert_module_entry;

#endif /* PHP_FAST_ASSERT_H */

#ifndef PHP_FAST_ASSERT_H
#define PHP_FAST_ASSERT_H

#define PHP_FAST_ASSERT_VERSION "0.1.1"
#define PHP_FAST_ASSERT_EXTNAME "fast_assert"

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

extern "C" {
#include "php.h"
}

typedef struct _fast_assert_globals {
	// global object handles pointing to the 3 commonly used assert objects
	zend_object_handle invalid_arg_assert_handle;
	zend_object_handle unexpected_val_assert_handle;
	zend_object_handle logic_exception_assert_handle;
} fast_assert_globals;

#ifdef ZTS
#define AssertGlobals(v) TSRMG(fa_globals_id, fast_assert_globals *, v)
extern int fa_globals_id;
#else
#define AssertGlobals(v) (fa_globals.v)
extern fast_assert_globals fa_globals;
#endif /* ZTS */

extern zend_module_entry fast_assert_module_entry;
#define phpext_fast_assert_ptr &fast_assert_module_entry;

#endif /* PHP_FAST_ASSERT_H */

Add bugfix version to match package version parity


#include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	load_dir("obj", 1);
	load_dir("sys", 1);
}

void full_reset()
{
	object turkeylist;
	object cursor;
	object first;
	object this;

	ACCESS_CHECK(PRIVILEGED());

	turkeylist = new_object(BIGSTRUCT_DEQUE_LWO);

	this = this_object();
	cursor = KERNELD->first_link("Help");
	first = cursor;

	do {
		LOGD->post_message("help", LOG_DEBUG, "Listing " + object_name(cursor));
		turkeylist->push_back(cursor);
		cursor = KERNELD->next_link(cursor);
	} while (cursor != first);

	while (!turkeylist->empty()) {
		object turkey;

		turkey = turkeylist->get_front();
		turkeylist->pop_front();

		if (!turkey || turkey == this) {
			/* don't self destruct or double destruct */
			continue;
		}

		destruct_object(turkey);
	}

	load_dir("obj", 1);
	load_dir("sys", 1);
}

#include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	load_dir("obj", 1);
	load_dir("sys", 1);
}

void full_reset()
{
	object turkeylist;
	object cursor;
	object first;
	object this;

	ACCESS_CHECK(PRIVILEGED());

	turkeylist = new_object(BIGSTRUCT_DEQUE_LWO);

	this = this_object();
	cursor = KERNELD->first_link("Help");
	first = cursor;

	do {
		turkeylist->push_back(cursor);
		cursor = KERNELD->next_link(cursor);
	} while (cursor != first);

	while (!turkeylist->empty()) {
		object turkey;

		turkey = turkeylist->get_front();
		turkeylist->pop_front();

		if (!turkey || turkey == this) {
			/* don't self destruct or double destruct */
			continue;
		}

		destruct_object(turkey);
	}

	load_dir("obj", 1);
	load_dir("sys", 1);
}

Remove now needless debug spam

Remove now needless debug spam


#define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1

#define PIN_CW 5
#define PIN_CCW 6

#define PIN_SWITCH_FORWARDS 12
#define PIN_SWITCH_BACKWARDS 13

#define GAS_VALUE_MIN 442
#define GAS_VALUE_MAX 520

#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331

#define BATTERY_VOLTAGE_MIN 11

#define SPEED_MIN 0
#define SPEED_MAX_DIRECTION_CHANGE 15
#define SPEED_MAX_FORWARDS 255
#define SPEED_MAX_BACKWARDS 255
#define SPEED_CHANGE_PACE_DEFAULT 10

#define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1

#define PIN_CW 5
#define PIN_CCW 6

#define PIN_SWITCH_FORWARDS 10
#define PIN_SWITCH_BACKWARDS 11

#define GAS_VALUE_MIN 446
#define GAS_VALUE_MAX 510

#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331

#define BATTERY_VOLTAGE_MIN 11

#define SPEED_MIN 0
#define SPEED_MAX_DIRECTION_CHANGE 15
#define SPEED_MAX_FORWARDS 255
#define SPEED_MAX_BACKWARDS 142
#define SPEED_CHANGE_PACE_DEFAULT 10

Adjust Speed min/max Adjust Gas min/max Use other Pins for gear forwards/backwards


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

int main(int argc, char** argv)
{
	if (argc < 2) {
		printf("Hey, I need an input file!\n");
		return 0;
	}

  while (1) {
    struct sass_file_context* ctx = sass_new_file_context();
    ctx->options.include_paths = "::/blah/bloo/fuzz:/slub/flub/chub::/Users/Aaron/dev/libsass/::::/huzz/buzz:::";
    ctx->options.output_style = SASS_STYLE_NESTED;
    ctx->input_path = argv[1];

    sass_compile_file(ctx);

    if (ctx->error_status) {
      if (ctx->error_message) printf("%s", ctx->error_message);
      else printf("An error occured; no error message available.\n");
      break;
    }
    else if (ctx->output_string) {
      continue;
    }
    else {
      printf("Unknown internal error.\n");
      break;
    }

    sass_free_file_context(ctx);
  }
	return 0;
}

Test to see whether or not there are memory leaks.


/* $OpenBSD: version.h,v 1.64 2012/02/09 20:00:18 markus Exp $ */

#define SSH_VERSION	"OpenSSH_6.0"

#define SSH_PORTABLE	"p1"
#define SSH_RELEASE	SSH_VERSION SSH_PORTABLE

/* $OpenBSD: version.h,v 1.64 2012/02/09 20:00:18 markus Exp $ */

#define SSH_VERSION	"OpenSSH_6.0"

#define SSH_PORTABLE	"p1"
#define SSH_PORT_NOTE   "Barrelfish port"
#define SSH_RELEASE	SSH_VERSION SSH_PORTABLE SSH_PORT_NOTE

openssh: Change the reported openssh release string to indicate the barrelfish
port.


//
//  SVProgressHUDAppDelegate.h
//  SVProgressHUD
//
//  Created by Sam Vermette on 27.03.11.
//  Copyright 2011 Sam Vermette. All rights reserved.
//

#import <UIKit/UIKit.h>

@class ViewController;

@interface AppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *window;
    ViewController *viewController;
}

@property (nonatomic) IBOutlet UIWindow *window;
@property (nonatomic) IBOutlet ViewController *viewController;

@end

//
//  SVProgressHUDAppDelegate.h
//  SVProgressHUD
//
//  Created by Sam Vermette on 27.03.11.
//  Copyright 2011 Sam Vermette. All rights reserved.
//

#import <UIKit/UIKit.h>

@class ViewController;

@interface AppDelegate : NSObject <UIApplicationDelegate> {
    UIWindow *__weak window;
    ViewController *__weak viewController;
}

@property (weak, nonatomic) IBOutlet UIWindow *window;
@property (weak, nonatomic) IBOutlet ViewController *viewController;

@end

Convert demo project to ARC.

Convert demo project to ARC.


#define TEST_NAME "sodium_core"
#include "cmptest.h"

int main(void)
{
    printf("%d\n", sodium_init());

    (void)sodium_runtime_has_neon();
    (void)sodium_runtime_has_sse2();
    (void)sodium_runtime_has_sse3();

    return 0;
}

#define TEST_NAME "sodium_core"
#include "cmptest.h"

int main(void)
{
    printf("%d\n", sodium_init());

    (void)sodium_runtime_has_neon();
    (void)sodium_runtime_has_sse2();
    (void)sodium_runtime_has_sse3();
    (void)sodium_runtime_has_pclmul();
    (void)sodium_runtime_has_aesni();

    return 0;
}

Test for presence of new sodium_runtime_has_*() functions


#include <assert.h>
#include <inform/dist.h>
#include <math.h>

int main()
{
    inform_dist *dist = inform_dist_create((uint32_t[4]){3, 0, 1, 2}, 4);
    assert(abs(inform_dist_prob(dist, 0) -    0.5) < 1e-6);
    assert(abs(inform_dist_prob(dist, 1) -    0.0) < 1e-6);
    assert(abs(inform_dist_prob(dist, 2) - 0.1666) < 1e-6);
    assert(abs(inform_dist_prob(dist, 3) - 0.3333) < 1e-6);
    inform_dist_free(dist);
}

#include <assert.h>
#include <inform/dist.h>
#include <math.h>

int main()
{
    inform_dist *dist = inform_dist_create((uint32_t[4]){3, 0, 1, 2}, 4);
    assert(fabs(inform_dist_prob(dist, 0) -    0.5) < 1e-6);
    assert(fabs(inform_dist_prob(dist, 1) -    0.0) < 1e-6);
    assert(fabs(inform_dist_prob(dist, 2) - 0.1666) < 1e-6);
    assert(fabs(inform_dist_prob(dist, 3) - 0.3333) < 1e-6);
    for (size_t i = 0; i < 4; ++i)
    {
        printf("%lf  ", inform_dist_prob(dist, i));
    }
    printf("\n");
    inform_dist_free(dist);
}

Fix example build under clang

Fix example build under clang


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

    This file is part of FLINT.

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

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

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

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

    Copyright (C) 2012 Sebastian Pancratz
    Copyright (C) 2012 Andres Goens
    Copyright (C) 2013 Mike Hansen

******************************************************************************/

#include <stdio.h>

#include "fq.h"
#include "ulong_extras.h"
#include "long_extras.h"

int
main(void)
{
    int i, result;
    flint_rand_t state;

    flint_printf("pth_root... ");
    fflush(stdout);

    flint_randinit(state);

    /* Compare with sum of Galois conjugates */
    for (i = 0; i < 1000; i++)
    {
        fq_ctx_t ctx;
        fq_t a, b;

        fq_ctx_randtest(ctx, state);

        fq_init(a, ctx);
        fq_init(b, ctx);

        fq_randtest(a, state, ctx);
        fq_pth_root(b, a, ctx);
        fq_pow(b, b, fq_ctx_prime(ctx), ctx);

        result = fq_equal(a, b, ctx);
        if (!result)
        {
            flint_printf("FAIL:\n\n");
            flint_printf("a = "), fq_print_pretty(a, ctx), flint_printf("\n");
            flint_printf("b = "), fq_print_pretty(b, ctx), flint_printf("\n");
            abort();
        }

        fq_clear(a, ctx);
        fq_clear(b, ctx);

        fq_ctx_clear(ctx);
    }

    flint_randclear(state);
    _fmpz_cleanup();
    flint_printf("PASS\n");
    return EXIT_SUCCESS;
}

Add a test for fq_pth_root.

Add a test for fq_pth_root.


/*
Copyright (c) 2015 ThreadScan authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#ifndef _THREADSCAN_H_
#define _THREADSCAN_H_

/**
 * Submit a pointer for memory reclamation.  threadscan_collect() will call
 * free() on the pointer, itself, when there are no more outstanding
 * references on the stack or in blocks of memory specified using
 * threadscan_register_local_block().
 */
extern void threadscan_collect (void *ptr);

/**
 * Specify a block of memory, local to the thread that called the function,
 * that ThreadScan will search during the reclamation phase.  Without this
 * call ThreadScan will search only the thread stacks.
 */
extern void threadscan_register_local_block (void *addr, size_t size);

#endif // !defined _THREADSCAN_H_

Add a header file for users to include.

Add a header file for users to include.

threadscan.h lists the library's exported functions for simplicity.


/** @file
  GUID for PcAtChipsetPkg PCD Token Space

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

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

**/

#ifndef _PCATCHIPSET_TOKEN_SPACE_GUID_H_
#define _PCATCHIPSET_TOKEN_SPACE_GUID_H_

#define PCATCHIPSET_TOKEN_SPACE_GUID \
  { \
    0x326ae723, 0xae32, 0x4589, { 0x98, 0xb8, 0xca, 0xc2, 0x3c, 0xdc, 0xc1, 0xb1 } \
  }

extern EFI_GUID gPcAtChipsetPkgTokenSpaceGuid;

#endif

Add declaration header file for token space.

git-svn-id: 5832b8bc916ddbdd95b25464e449aa07e9932e08@8781 6f19259b-4bc3-4df7-8a09-765794883524


#include <assert.h>
#include <stddef.h>

int main() {
  int r; // rand
  int i = 0;
  int *p;

  if (r)
    p = &i;
  else
    p = NULL;

  if (*p == 2) // WARN
    assert(1); // reachable (via UB)
  return 0;
}

Add NULL dereferenced top value test

Add NULL dereferenced top value test

This is why we assumed this to be unreachable:
https://gitlab.com/sosy-lab/benchmarking/sv-benchmarks/-/merge_requests/1364


//
// mysociety_error.cpp:
// Some helpers.
//
// Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
// Email: francis@mysociety.org; WWW: http://www.mysociety.org/
//
// $Id: mysociety_error.h,v 1.1 2009-03-23 09:30:06 francis Exp $
//

#include <string>

#if defined(OUTPUT_ROUTE_DETAILS) or defined(DEBUG)
#include <boost/format.hpp>
#endif

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

/* Logging and debug assertions. Use assert for assertion that matter in release mode,
 * debug_assert for ones that can be stripped. */
#ifdef DEBUG
    void do_log(boost::basic_format<char, std::char_traits<char>, std::allocator<char> > &bf) {
        puts(bf.str().c_str());
    }
    void do_log(const std::string& str) {
        puts(str.c_str());
    }
    #define log(message) do_log(message);
    #define debug_assert(thing) assert(thing);
#else
    #define log(message) while(0) { };
    #define debug_assert(thing) while(0) { };
#endif

/* Most similar to Python's Exception */
class Exception : public std::exception
{
    std::string s;
public:
    Exception(std::string s_) : s("Exception: " + s_) { }
    ~Exception() throw() { }
    const char* what() const throw() { return s.c_str(); }
};

/* Error handling version of fread */
void my_fread ( void * ptr, size_t size, size_t count, FILE * stream ) {
    size_t ret = fread(ptr, size, count, stream);
    assert(ret == count);
}

Split up C++ program into separate files and put its components into proper places.


#ifndef COMPAT_H
#define COMPAT_H

#ifndef HAVE_PLEDGE
#include "pledge.h"
#endif

#ifndef HAVE_STRTONUM
#include "strtonum.h"
#endif

#ifndef timespecsub
#define	timespecsub(tsp, usp, vsp)					\
	do {								\
		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		\
		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	\
		if ((vsp)->tv_nsec < 0) {				\
			(vsp)->tv_sec--;				\
			(vsp)->tv_nsec += 1000000000L;			\
		}							\
	} while (0)
#endif

#endif /* COMPAT_H */

#ifndef COMPAT_H
#define COMPAT_H

#ifndef HAVE_PLEDGE
#include "pledge.h"
#endif

#ifndef HAVE_STRTONUM
#include "strtonum.h"
#endif

/* Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available */
#ifndef CLOCK_MONOTONIC
#define CLOCK_MONOTONIC CLOCK_REALTIME
#endif

#ifndef timespecsub
#define	timespecsub(tsp, usp, vsp)					\
	do {								\
		(vsp)->tv_sec = (tsp)->tv_sec - (usp)->tv_sec;		\
		(vsp)->tv_nsec = (tsp)->tv_nsec - (usp)->tv_nsec;	\
		if ((vsp)->tv_nsec < 0) {				\
			(vsp)->tv_sec--;				\
			(vsp)->tv_nsec += 1000000000L;			\
		}							\
	} while (0)
#endif

#endif /* COMPAT_H */

Use CLOCK_REALTIME if CLOCK_MONOTONIC is not available.


/* A solution to Exercise 2-2 in The C Programming Language (Second Edition).
 */

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

int main(void)
{
  uint32_t i = 0;
  uint32_t lim = 100;
  char c = 0;
  char s[lim];
  while (i < (lim - 1)) {
    c = getchar();
    if (c != '\n') {
      if (c != EOF) {
        s[i++] = c;
      }
    }
  }
  s[i] = '\0';
  puts(s);
  return EXIT_SUCCESS;
}

Add solution to Exercise 2-2.

Add solution to Exercise 2-2.


#include "Enesim.h"

int main(int argc, char **argv)
{
	Enesim_Renderer *r;
	Enesim_Surface *s;

	enesim_init();
	r = enesim_renderer_rectangle_new();
	enesim_renderer_shape_fill_color_set(r, 0xffffffff);
	enesim_renderer_rectangle_width_set(r, 100);
	enesim_renderer_rectangle_height_set(r, 100);

	s = enesim_surface_new(ENESIM_FORMAT_ARGB8888, 320, 240);

	enesim_renderer_draw(r, s, NULL, 0, 0);
	enesim_shutdown();

	return 0;
}

Add an example renderer test

Add an example renderer test


// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: sleep 2
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s

#include "header2.h"

// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built

// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s

#include "header2.h"

// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built
// DISABLE: win32

Disable this test on win32. My "sleep 2" trick didn't seem to work

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


#include "src/math/reinterpret.h"
#include <stdint.h>
#include <assert.h>

int64_t __fixtfdi(long double);

static _Bool run(int64_t a)
{
    return a == __fixtfdi(a);
}

int main(void)
{
    const int64_t delta = 0x0000002BA87B5A22;

    assert(run(INT64_MAX));
    assert(run(INT64_MIN));

    for (int64_t i = 0x3FFFFFFFFFFFFFFF; i < 0x4340000000000000; i += delta) {
        double x = reinterpret(double, i);
        assert(run(x));
        assert(run(-x));
    }

    for (int64_t i = 0; i <= INT64_MAX / delta; ++i) {
        assert(run(i * delta));
        assert(run(i * -delta));
    }
}

Test int64_t -> long double

Test int64_t -> long double


//
//  ofxSocketIO.h
//
//  Created by hugohil on 05/02/16.
//
//
#pragma once

#include "ofMain.h"
#include "ofEvents.h"
#if defined(_MSC_VER) || defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
  // Windows stuff
#else
  // Linux and OSX here
  #include <sio_client.h>
#endif
#include "ofxSocketIOData.h"

class ofxSocketIO : protected ofThread {
private :
  sio::client client;

  std::string currentStatus;

  void onConnect();
  void onClose(sio::client::close_reason const& reason);
  void onFail();
  void onTryReconnect();

public :
  void setup(std::string& address);
  void setup(std::string& address, std::map<std::string,std::string>& query);

  void bindEvent(ofEvent<ofxSocketIOData&>& event, std::string eventName, std::string nsp="");

  ofEvent<void> connectionEvent;
  ofEvent<std::string> notifyEvent;

  void emit(std::string& eventName);
  void emit(std::string& eventName, std::string& data, std::string nsp="");
  void emitBinary(std::string& eventName, shared_ptr<string> const& bStr, std::string nsp="");

  void closeConnection();
  void openConnection(std::string& address);
};

//
//  ofxSocketIO.h
//
//  Created by hugohil on 05/02/16.
//
//
#pragma once

#include "ofMain.h"
#include "ofEvents.h"
#if defined(_MSC_VER) || defined(_WIN32) || defined(WIN32) || defined(__MINGW32__)
  // Windows stuff
#else
  // Linux and OSX here
  #include <sio_client.h>
#endif
#include "ofxSocketIOData.h"

class ofxSocketIO : protected ofThread {
private :
  sio::client client;

  void onConnect();
  void onClose(sio::client::close_reason const& reason);
  void onFail();
  void onTryReconnect();

public :
  std::string currentStatus = "close";

  void setup(std::string& address);
  void setup(std::string& address, std::map<std::string,std::string>& query);

  void bindEvent(ofEvent<ofxSocketIOData&>& event, std::string eventName, std::string nsp="");

  ofEvent<void> connectionEvent;
  ofEvent<std::string> notifyEvent;

  void emit(std::string& eventName);
  void emit(std::string& eventName, std::string& data, std::string nsp="");
  void emitBinary(std::string& eventName, shared_ptr<string> const& bStr, std::string nsp="");

  void closeConnection();
  void openConnection(std::string& address);
};

Set currentStatus public and add default value


#ifndef VAST_ACCESS_H
#define VAST_ACCESS_H

namespace vast {

/// Wrapper to encapsulate the implementation of concepts requiring access to
/// private state.
struct access
{
  template <typename, typename = void>
  struct state;

  template <typename, typename = void>
  struct parsable;

  template <typename, typename = void>
  struct printable;

  template <typename, typename = void>
  struct convertible;
};

} // namespace vast

#endif

#ifndef VAST_ACCESS_H
#define VAST_ACCESS_H

namespace vast {

/// Wrapper to encapsulate the implementation of concepts requiring access to
/// private state.
struct access
{
  template <typename, typename = void>
  struct state;

  template <typename, typename = void>
  struct parser;

  template <typename, typename = void>
  struct printer;

  template <typename, typename = void>
  struct converter;
};

namespace detail {

struct has_access_state
{
  template <typename T>
  static auto test(T* x) -> decltype(access::state<T>{}, std::true_type());

  template <typename>
  static auto test(...) -> std::false_type;
};

struct has_access_parser
{
  template <typename T>
  static auto test(T* x) -> decltype(access::parser<T>{}, std::true_type());

  template <typename>
  static auto test(...) -> std::false_type;
};

struct has_access_printer
{
  template <typename T>
  static auto test(T* x) -> decltype(access::printer<T>{}, std::true_type());

  template <typename>
  static auto test(...) -> std::false_type;
};

struct has_access_converter
{
  template <typename T>
  static auto test(T* x) -> decltype(access::converter<T>{}, std::true_type());

  template <typename>
  static auto test(...) -> std::false_type;
};

} // namespace detail

template <typename T>
struct has_access_state : decltype(detail::has_access_state::test<T>(0)) {};

template <typename T>
struct has_access_parser : decltype(detail::has_access_parser::test<T>(0)) {};

template <typename T>
struct has_access_printer : decltype(detail::has_access_printer::test<T>(0)) {};

template <typename T>
struct has_access_converter : decltype(detail::has_access_converter::test<T>(0)) {};

} // namespace vast

#endif

Add traits for befriendable concepts.

Add traits for befriendable concepts.


#include "erl_nif.h"

#include <sodium.h>

#include "hash.h"

ERL_NIF_TERM enacl_crypto_hash_nif(ErlNifEnv *env, int argc,
                                   ERL_NIF_TERM const argv[]) {
  ErlNifBinary input;
  ErlNifBinary result;
  ERL_NIF_TERM ret;

  if ((argc != 1) || (!enif_inspect_iolist_as_binary(env, argv[0], &input)))
    goto bad_arg;

  if (!enif_alloc_binary(crypto_hash_BYTES, &result))
    goto err;

  crypto_hash(result.data, input.data, input.size);
  ret = enif_make_binary(env, &result);
  goto done;

bad_arg:
  return enif_make_badarg(env);

err:
  ret = nacl_error_tuple(env, "alloc_failed");
done:
  return ret;
}

#include "erl_nif.h"

#include <sodium.h>

#include "hash.h"

ERL_NIF_TERM enacl_crypto_hash(ErlNifEnv *env, int argc,
                               ERL_NIF_TERM const argv[]) {
  ErlNifBinary input;
  ErlNifBinary result;
  ERL_NIF_TERM ret;

  if ((argc != 1) || (!enif_inspect_iolist_as_binary(env, argv[0], &input)))
    goto bad_arg;

  if (!enif_alloc_binary(crypto_hash_BYTES, &result))
    goto err;

  crypto_hash(result.data, input.data, input.size);
  ret = enif_make_binary(env, &result);
  goto done;

bad_arg:
  return enif_make_badarg(env);

err:
  ret = nacl_error_tuple(env, "alloc_failed");
done:
  return ret;
}

Fix name of C function

Fix name of C function

The name of the generichash function was wrong, so it was not possible to find it when
loading the NIF.


/*
name: TEST040
description: Test for bug parsing typenames in struct definition
output:

*/

typedef struct List List;
struct List {
	int len;
	struct List *head;
};

Add test for bug parsing typenames in structs

When a struct is parsed the namespace of the lexer is
changed to the namespace of the struct, which hides
the definition of types, which should be visible in
such context.


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

void debug(const char* format, ...) {
#ifdef __DEBUG__
    vprintf(format, args);
#endif // __DEBUG__
}

void initializeLogging() { }

#include "log.h"
#include <stdio.h>
#include <stdarg.h>

void debug(const char* format, ...) {
#ifdef __DEBUG__
    va_list args;
    va_start(args, format);
    vprintf(format, args);
    va_end(args);
#endif // __DEBUG__
}

void initializeLogging() { }

Fix debugging printouts when running tests.


//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines some helpful functions for dealing with the possibility of
// unix signals occuring while your program is running.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SYSTEM_SIGNALS_H
#define LLVM_SYSTEM_SIGNALS_H

#include "llvm/System/Path.h"

namespace llvm {
namespace sys {

  /// This function registers signal handlers to ensure that if a signal gets
  /// delivered that the named file is removed.
  /// @brief Remove a file if a fatal signal occurs.
  void RemoveFileOnSignal(const std::string &Filename);

  /// This function registers a signal handler to ensure that if a fatal signal
  /// gets delivered to the process that the named directory and all its
  /// contents are removed.
  /// @brief Remove a directory if a fatal signal occurs.
  void RemoveDirectoryOnSignal(const llvm::sys::Path& path);

  /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
  /// process, print a stack trace and then exit.
  /// @brief Print a stack trace if a fatal signal occurs.
  void PrintStackTraceOnErrorSignal();

} // End sys namespace
} // End llvm namespace

#endif

//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines some helpful functions for dealing with the possibility of
// unix signals occuring while your program is running.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SYSTEM_SIGNALS_H
#define LLVM_SYSTEM_SIGNALS_H

#include "llvm/System/Path.h"

namespace llvm {
namespace sys {

  /// This function registers signal handlers to ensure that if a signal gets
  /// delivered that the named file is removed.
  /// @brief Remove a file if a fatal signal occurs.
  void RemoveFileOnSignal(const Path &Filename);

  /// This function registers a signal handler to ensure that if a fatal signal
  /// gets delivered to the process that the named directory and all its
  /// contents are removed.
  /// @brief Remove a directory if a fatal signal occurs.
  void RemoveDirectoryOnSignal(const Path& path);

  /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
  /// process, print a stack trace and then exit.
  /// @brief Print a stack trace if a fatal signal occurs.
  void PrintStackTraceOnErrorSignal();

} // End sys namespace
} // End llvm namespace

#endif

Make the remove*OnSignal functions deal with Paths not strings

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


/*
 * Copyright (C) 2016  Bastien Penavayre
 *
 * 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.
 */
#define ARGUMENT_LIST(args...) args)
#define new(name, ctor) name ## _ ## ctor (0, ARGUMENT_LIST

void *String_ctor(const char *str)
{
    return 0;
}

int main()
{
    void *tmp = new(String, ctor)("Jello");
}

Add new future syntax for 'new' in Future folder


#include "builder.h"
#include "entity/board.h"

/**
 * A small board has 4 cells, and its layout is a square.
 * 1 ----- 2
 * |       |
 * |       |
 * |       |
 * 4 ----- 3
 */
int builder_create_small_board(s_board *b)
{
	int c;
	uint8_t nb_max_players;

	nb_max_players = 4;
	init_board(b, SMALL_BOARD_NB_CELLS, nb_max_players);

	for (c = 0; c < SMALL_BOARD_NB_CELLS; c++) {
		b->cells[c].neighbours[0] = &b->cells[(SMALL_BOARD_NB_CELLS + c - 1) % SMALL_BOARD_NB_CELLS];
		b->cells[c].neighbours[1] = &b->cells[(c + 1) % SMALL_BOARD_NB_CELLS];
		b->cells[c].nb_neighbours = 2;
	}

	return nb_max_players;
}

#include "builder.h"
#include "entity/board.h"

/**
 * A small board has 4 cells, and its layout is a square.
 * 1 ----- 2
 * |       |
 * |       |
 * |       |
 * 4 ----- 3
 */
int builder_create_small_board(s_board *b)
{
	int c;
	uint8_t nb_max_players;

	nb_max_players = 2;
	init_board(b, SMALL_BOARD_NB_CELLS, nb_max_players);

	for (c = 0; c < SMALL_BOARD_NB_CELLS; c++) {
		b->cells[c].neighbours[0] = &b->cells[(SMALL_BOARD_NB_CELLS + c - 1) % SMALL_BOARD_NB_CELLS];
		b->cells[c].neighbours[1] = &b->cells[(c + 1) % SMALL_BOARD_NB_CELLS];
		b->cells[c].nb_neighbours = 2;
	}

	return nb_max_players;
}

Revert "players number changed, for some tests"

This reverts commit 90457a3c218b08da4eeb4e9c6907b909878290f5.


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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 0.004;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 1.0;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

Increase the minimum interval for timers on background tabs to reduce
their CPU consumption.

The new interval is 1000 ms, or once per second. We can easily adjust
this value up or down, but this seems like a reasonable value to judge
the compatibility impact of this change.

BUG=66078
TEST=none (tested manually with minimal test case)

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@75430 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


/*
 * Copyright (c) 2017 Linaro Limited
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef _I2C_PRIV_H_
#define _I2C_PRIV_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <i2c.h>
#include <dt-bindings/i2c/i2c.h>

#ifndef SYS_LOG_LEVEL
#define SYS_LOG_LEVEL CONFIG_SYS_LOG_I2C_LEVEL
#endif
#include <logging/sys_log.h>

static inline u32_t _i2c_map_dt_bitrate(u32_t bitrate)
{
	switch (bitrate) {
	case I2C_BITRATE_STANDARD:
		return I2C_SPEED_STANDARD << I2C_SPEED_SHIFT;
	case I2C_BITRATE_FAST:
		return I2C_SPEED_FAST << I2C_SPEED_SHIFT;
	case I2C_BITRATE_FAST_PLUS:
		return I2C_SPEED_FAST_PLUS << I2C_SPEED_SHIFT;
	case I2C_BITRATE_HIGH:
		return I2C_SPEED_HIGH << I2C_SPEED_SHIFT;
	case I2C_BITRATE_ULTRA:
		return I2C_SPEED_ULTRA << I2C_SPEED_SHIFT;
	}

	SYS_LOG_ERR("Invalid I2C bit rate value");

	return 0;
}

#ifdef __cplusplus
}
#endif

#endif /* _I2C_PRIV_H_ */

i2c: Add helper function to map from bitrate values to zephyr cfg

Add _i2c_map_dt_bitrate() that maps from a bitrate to the I2C zephyr
cfg bit fields used in i2c_configure().

Signed-off-by: Kumar Gala <a5e5248af4cd4f0ed8c515f61d40a6e2db46a66e@linaro.org>


//
// Copyright 2011-2012 Jeff Bush
//
// 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.
//

//
// Non-interactive test runner just produces register traces and memory dumps
//

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <stdarg.h>
#include "core.h"
#include "debug_info.h"

void runNonInteractive(Core *core)
{
	int i;

	enableTracing(core);
	for (i = 0; i < 20; i++)
	{
		if (!runQuantum(core))
			break;
	}
}

//
// Copyright 2011-2012 Jeff Bush
//
// 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.
//

//
// Non-interactive test runner just produces register traces and memory dumps
//

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/poll.h>
#include <stdarg.h>
#include "core.h"
#include "debug_info.h"

void runNonInteractive(Core *core)
{
	int i;

	enableTracing(core);
	for (i = 0; i < 40; i++)
	{
		if (!runQuantum(core))
			break;
	}
}

Increase instruction count in emulator

Increase instruction count in emulator


/*
 * Copyright (c) 2005 David Xu
 * 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. Neither the name of the author nor the names of any co-contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * 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 "thr_private.h"

void
_thread_bp_create(void)
{
}

void
_thread_bp_death(void)
{
}

void
_thr_report_creation(struct pthread *curthread, struct pthread *newthread)
{
	curthread->event_buf.event = TD_CREATE;
	curthread->event_buf.th_p = (td_thrhandle_t *)newthread;
	curthread->event_buf.data = 0;
	THR_UMTX_LOCK(curthread, &_thr_event_lock);
	_thread_last_event = curthread;
	_thread_bp_create();
	_thread_last_event = NULL;
	THR_UMTX_UNLOCK(curthread, &_thr_event_lock);
}

void
_thr_report_death(struct pthread *curthread)
{
	curthread->event_buf.event = TD_DEATH;
	curthread->event_buf.th_p = (td_thrhandle_t *)curthread;
	curthread->event_buf.data = 0;
	THR_UMTX_LOCK(curthread, &_thr_event_lock);
	_thread_last_event = curthread;
	_thread_bp_death();
	_thread_last_event = NULL;
	THR_UMTX_UNLOCK(curthread, &_thr_event_lock);
}

Add missing event reporting code.

Add missing event reporting code.


/*ckwg +5
 * Copyright 2012 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#ifndef VISTK_PYTHON_HELPERS_EXCEPTIONS_H
#define VISTK_PYTHON_HELPERS_EXCEPTIONS_H

#define HANDLE_PYTHON_EXCEPTION(call)       \
  try                                       \
  {                                         \
    call;                                   \
  }                                         \
  catch (boost::python::error_already_set&) \
  {                                         \
    PyErr_Print();                          \
                                            \
    throw;                                  \
  }

#endif // VISTK_PYTHON_HELPERS_EXCEPTIONS_H

/*ckwg +5
 * Copyright 2012 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#ifndef VISTK_PYTHON_HELPERS_EXCEPTIONS_H
#define VISTK_PYTHON_HELPERS_EXCEPTIONS_H

/// \todo More useful output?

#define HANDLE_PYTHON_EXCEPTION(call)       \
  try                                       \
  {                                         \
    call;                                   \
  }                                         \
  catch (boost::python::error_already_set&) \
  {                                         \
    PyErr_Print();                          \
                                            \
    throw;                                  \
  }

#endif // VISTK_PYTHON_HELPERS_EXCEPTIONS_H

Add a todo for more useful Python exception output


#ifndef SCC_SEMANTIC_HEADER
#define SCC_SEMANTIC_HEADER

#include <stdio.h>
#include "syntax.h"
#include "symboltable.h"

int semantic_analysis(Syntax * top_level);

#endif

#ifndef SCC_SEMANTIC_HEADER
#define SCC_SEMANTIC_HEADER

#include <stdio.h>
#include <stdbool.h>
#include "syntax.h"
#include "symboltable.h"

bool semantic_analysis(Syntax * top_level);

#endif

Change the return type to bool.

Change the return type to bool.


#ifndef RSTORE_UITLS_H
#define RSTORE_UITLS_H
#include <RStore.h>
#include <ParsedRStore.h>
RS_RStore RS_lowerRStore(PRS_RStore store);
#endif

#ifndef RSTORE_UITLS_H
#define RSTORE_UITLS_H
#include <RStore.h>
#include <ParsedRStore.h>
RS_RStore RS_lowerRStore(PRS_RStore store);
PRS_RStore RS_liftRStore(RS_RStore store);
#endif

Add declaration of lift function

Add declaration of lift function


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

#ifndef MACROS_H__
#define MACROS_H__

// TODO(bazel-team): Use the proper annotation for clang.
#define FALLTHROUGH_INTENDED do { } while (0)

#endif // MACROS_H__

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

#ifndef MACROS_H__
#define MACROS_H__

// GXX_EXPERIMENTAL_CXX0X is defined by gcc and clang up to at least
// gcc-4.7 and clang-3.1 (2011-12-13).  __cplusplus was defined to 1
// in gcc before 4.7 and clang before 3.1, but is defined according
// to the language version in effect thereafter.
#if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
// When compiled with clang c++11 standard with warning on switch
// fallthrough, tell the compiler not to complain when it was intended.
#if defined(__clang__) && defined(__has_warning)
#if __has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough")
#define FALLTHROUGH_INTENDED [[clang::fallthrough]]  // NOLINT
#endif
#endif
#endif

#ifndef FALLTHROUGH_INTENDED
#define FALLTHROUGH_INTENDED do { } while (0)
#endif

#endif // MACROS_H__

Allow external contributions on src/main/native

--
MOS_MIGRATED_REVID=90050516


//
//  SwiftyHTTP.h
//  SwiftyHTTP
//
//  Created by Helge Hess on 6/25/14.
//  Copyright (c) 2014 Always Right Institute. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for SwiftyHTTP.
FOUNDATION_EXPORT double SwiftyHTTPVersionNumber;

//! Project version string for SwiftyHTTP.
FOUNDATION_EXPORT const unsigned char SwiftyHTTPVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SwiftyHTTP/PublicHeader.h>

// No more bridging header in v0.0.4, need to make all C stuff public
#import <SwiftyHTTP/Parser/http_parser.h>

// I think the originals are not mapped because they are using varargs
FOUNDATION_EXPORT int ari_fcntlVi (int fildes, int cmd, int val);
FOUNDATION_EXPORT int ari_ioctlVip(int fildes, unsigned long request, int *val);

//
//  SwiftyHTTP.h
//  SwiftyHTTP
//
//  Created by Helge Hess on 6/25/14.
//  Copyright (c) 2014 Always Right Institute. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for SwiftyHTTP.
FOUNDATION_EXPORT double SwiftyHTTPVersionNumber;

//! Project version string for SwiftyHTTP.
FOUNDATION_EXPORT const unsigned char SwiftyHTTPVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <SwiftyHTTP/PublicHeader.h>

// No more bridging header in v0.0.4, need to make all C stuff public
#import <SwiftyHTTP/http_parser.h>

// I think the originals are not mapped because they are using varargs
FOUNDATION_EXPORT int ari_fcntlVi (int fildes, int cmd, int val);
FOUNDATION_EXPORT int ari_ioctlVip(int fildes, unsigned long request, int *val);

Include http_parser.h from the right spot (public header copied to framework headers)


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

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

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

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

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

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

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

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

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

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

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

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

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

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

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

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

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