<logging>
  <filter enabled="true">
    <tag>stdout</tag>
    <type>console</type>
    <!-- level is (:?FINEST|FINE|DEBUG|TRACE|INFO|WARNING|ERROR) -->
    <level>DEBUG</level>
  </filter>
  <filter enabled="false">
    <tag>debug_file</tag>
    <type>file</type>
    <level>DEBUG</level>
    <property name="filename">/tmp/pushs_job_debug.log</property>
    <property name="format">[%D %T] [%L] [%S] %M</property>
    <property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
    <property name="maxsize">0M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
    <property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
    <property name="daily">true</property> <!-- Automatically rotates when a log message is written after midnight -->
  </filter>
  <filter enabled="false">
    <tag>info_file</tag>
    <type>file</type>
    <level>INFO</level>
    <property name="filename">/tmp/pushs_job_info.log</property>
    <!--
       %T - Time (15:04:05 MST)
       %t - Time (15:04)
       %D - Date (2006/01/02)
       %d - Date (01/02/06)
       %L - Level (FNST, FINE, DEBG, TRAC, WARN, EROR, CRIT)
       %S - Source
       %M - Message
       It ignores unknown format strings (and removes them)
       Recommended: "[%D %T] [%L] (%S) %M"
    -->
    <property name="format">[%D %T] [%L] [%S] %M</property>
    <property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
    <property name="maxsize">0M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
    <property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
    <property name="daily">true</property> <!-- Automatically rotates when a log message is written after midnight -->
  </filter>
  <filter enabled="false">
    <tag>warn_file</tag>
    <type>file</type>
    <level>WARNING</level>
    <property name="filename">/tmp/pushs_job_warn.log</property>
    <property name="format">[%D %T] [%L] [%S] %M</property>
    <property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
    <property name="maxsize">0M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
    <property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
    <property name="daily">true</property> <!-- Automatically rotates when a log message is written after midnight -->
  </filter>
  <filter enabled="false">
    <tag>error_file</tag>
    <type>file</type>
    <level>ERROR</level>
    <property name="filename">/tmp/pushs_job_error.log</property>
    <property name="format">[%D %T] [%L] [%S] %M</property>
    <property name="rotate">true</property> <!-- true enables log rotation, otherwise append -->
    <property name="maxsize">0M</property> <!-- \d+[KMG]? Suffixes are in terms of 2**10 -->
    <property name="maxlines">0K</property> <!-- \d+[KMG]? Suffixes are in terms of thousands -->
    <property name="daily">true</property> <!-- Automatically rotates when a log message is written after midnight -->
  </filter>
</logging>


{
  val pluginVersion = System.getProperty("plugin.version")
  if(pluginVersion == null)
    throw new RuntimeException("""|The system property 'plugin.version' is not defined.
                                  |Specify this property using the scriptedLaunchOpts -D.""".stripMargin)
  else addSbtPlugin("com.github.gseitz" % "sbt-protobuf" % pluginVersion)
}


use runtime_native::Native;

#[runtime::test(Native)]
async fn spawn() {
    let handle = runtime::spawn(async {
        println!("hello planet from Native");
        42
    });
    assert_eq!(handle.await, 42);
}


#! /bin/sh

config=$1

die(){
    echo "$@"
    exit 1
}

test -r "$config"  || die "usage: fate.sh <config>"

workdir=$(cd $(dirname $config) && pwd)
make=make
tar='tar c'

. "$config"

test -n "$slot"    || die "slot not specified"
test -n "$repo"    || die "repo not specified"
test -d "$samples" || die "samples location not specified"

: ${branch:=master}

lock(){
    lock=$1/fate.lock
    (set -C; exec >$lock) 2>/dev/null || return
    trap 'rm $lock' EXIT
}

checkout(){
    case "$repo" in
        file:*|/*) src="${repo#file:}"      ;;
        git:*)     git clone --quiet --branch "$branch" "$repo" "$src" ;;
    esac
}

update()(
    cd ${src} || return
    case "$repo" in
        git:*) git fetch --quiet --force && git reset --quiet --hard "origin/$branch" ;;
    esac
)

configure()(
    cd ${build} || return
    ${shell} ${src}/configure                                           \
        --prefix="${inst}"                                              \
        --samples="${samples}"                                          \
        --enable-gpl                                                    \
        --enable-memory-poisoning                                       \
        --enable-avresample                                             \
        ${ignore_tests:+--ignore-tests="$ignore_tests"}                 \
        ${arch:+--arch=$arch}                                           \
        ${cpu:+--cpu="$cpu"}                                            \
        ${toolchain:+--toolchain="$toolchain"}                          \
        ${cross_prefix:+--cross-prefix="$cross_prefix"}                 \
        ${as:+--as="$as"}                                               \
        ${cc:+--cc="$cc"}                                               \
        ${ld:+--ld="$ld"}                                               \
        ${target_os:+--target-os="$target_os"}                          \
        ${sysroot:+--sysroot="$sysroot"}                                \
        ${target_exec:+--target-exec="$target_exec"}                    \
        ${target_path:+--target-path="$target_path"}                    \
        ${target_samples:+--target-samples="$target_samples"}           \
        ${extra_cflags:+--extra-cflags="$extra_cflags"}                 \
        ${extra_ldflags:+--extra-ldflags="$extra_ldflags"}              \
        ${extra_libs:+--extra-libs="$extra_libs"}                       \
        ${extra_conf}
)

compile()(
    cd ${build} || return
    ${make} ${makeopts} && ${make} install
)

fate()(
    test "$build_only" = "yes" && return
    cd ${build} || return
    ${make} ${makeopts_fate-${makeopts}} -k fate
)

clean(){
    rm -rf ${build} ${inst}
}

report(){
    date=$(date -u +%Y%m%d%H%M%S)
    echo "fate:1:${date}:${slot}:${version}:$1:$2:${branch}:${comment}" >report
    cat ${build}/ffbuild/config.fate >>report
    cat ${build}/tests/data/fate/*.rep >>report 2>/dev/null || for i in ${build}/tests/data/fate/*.rep ; do cat "$i" >>report 2>/dev/null; done
    test -n "$fate_recv" && $tar report *.log | gzip | $fate_recv
}

fail(){
    report "$@"
    clean
    exit
}

mkdir -p ${workdir} || die "Error creating ${workdir}"
lock ${workdir}     || die "${workdir} locked"
cd ${workdir}       || die "cd ${workdir} failed"

src=${workdir}/src
: ${build:=${workdir}/build}
: ${inst:=${workdir}/install}

test -d "$src" && update || checkout || die "Error fetching source"

cd ${workdir}

version=$(${src}/ffbuild/version.sh ${src})
test "$version" = "$(cat version-$slot 2>/dev/null)" && exit 0
echo ${version} >version-$slot

rm -rf "${build}" *.log
mkdir -p ${build}

configure >configure.log 2>&1 || fail 3 "error configuring"
compile   >compile.log   2>&1 || fail 2 "error compiling"
fate      >test.log      2>&1 || fail 1 "error testing"
report 0 success
clean


/* OpenCL built-in library: half_exp2()

   Copyright (c) 2011-2013 Erik Schnetter

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

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

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

#include "templates.h"

DEFINE_EXPR_F_F(half_exp2, exp2(a))


-----------------------------------
-- Area: Southern San d'Oria
--  NPC: Foletta
--  General Info NPC
-------------------------------------
local ID = require("scripts/zones/Southern_San_dOria/IDs");
require("scripts/globals/settings");
require("scripts/globals/quests");

function onTrade(player,npc,trade)
    -- "Flyers for Regine" conditional script
    local FlyerForRegine = player:getQuestStatus(SANDORIA,dsp.quest.id.sandoria.FLYERS_FOR_REGINE);

    if (FlyerForRegine == 1) then
        local count = trade:getItemCount();
        local MagicFlyer = trade:hasItemQty(532,1);
        if (MagicFlyer == true and count == 1) then
            player:messageSpecial(ID.text.FLYER_REFUSED);
        end
    end
end;

function onTrigger(player,npc)
    player:startEvent(666);
end;

function onEventUpdate(player,csid,option)
end;

function onEventFinish(player,csid,option)
end;


void drawWellGrid(int w, int h)
{
  for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
      stroke(0xFFBBBB00);
      fill(0xFF00FF00);
      rect(x*BlockScale, y*BlockScale, BlockScale, BlockScale);
    }
  }
}

void drawBlocks(int w, int h, boolean[][] blocks) {
  for (int x = 0; x < w; x++) {
    for (int y = 0; y < h; y++) {
      if (blocks[x][y]) {
        //fill(0xFF000000 | (int)random(0xFFFFFF)); // For fun.
        fill(0xFF0000FF);
        rect(x*BlockScale, y*BlockScale, BlockScale, BlockScale);
      }
    }
  }
}

void drawFallingBlock(Block block)
{
  if (block == null)
    return;

  BlockPart[] parts = block.parts;

  stroke(0x00BB0000);
  fill(0xFFFF0000);

  for (int i = 0; i < BlockPartsCount; i++)
    rect(parts[i].xPos*BlockScale, parts[i].yPos*BlockScale, BlockScale, BlockScale);
}

void drawNextBlock(Block block,int x,int y) {
  if (block == null)
    return;

  BlockPart[] parts = block.parts;
  stroke(255,0,0);
  fill(255,255,0);
  for (int i = 0; i < BlockPartsCount; i++)
    rect(parts[i].xPos*BlockScale+x, parts[i].yPos*BlockScale+y, BlockScale, BlockScale);
}

void drawGameState(Game game)
{
  drawWellGrid(game.wellWidth, game.wellHeight);
  drawBlocks(game.wellWidth, game.wellHeight, game.blocks);
  drawFallingBlock(game.fallingBlock);
}


/**
 * @file
 * @note Derived from addr2line.c and associated binutils files, version 2.18.
 */

#include <unistd.h>

#include <sys/stat.h>

#include <getopt.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <limits.h>
#include <assert.h>

#pragma GCC visibility push(hidden)
#include "bfd.h"
#include "bucomm.h"
#include "demangle.h"
#include "libiberty.h"
#pragma GCC visibility pop

typedef struct _libtrace_data
{
	bfd_boolean unwind_inlines; /**< Unwind inlined functions. */
	bfd_boolean with_functions; /**< Show function names.  */
	bfd_boolean do_demangle; /**< Demangle names.  */
	bfd_boolean base_names; /**< Strip directory names.  */
	asymbol **syms; /**< Symbol table.  */

	bfd *abfd;
	asection *section;
} libtrace_data;

static libtrace_data m_libtrace_data = { .unwind_inlines = TRUE, .with_functions = TRUE, .do_demangle = TRUE,
		.base_names = TRUE, .syms = nullptr, .abfd = nullptr, .section = nullptr, };

/** These variables are used to pass information between
 translate_addresses and find_address_in_section.  */
typedef struct _sym_info
{
	bfd_vma pc;
	const char *filename;
	const char *functionname;
	unsigned int line;
	bfd_boolean found;
} sym_info;

static int slurp_symtab (bfd *);
static void find_address_in_section (bfd *, asection *, void *);
static void find_offset_in_section (bfd *, asection *, sym_info *);
static int translate_addresses (bfd *abfd, asection *section, void *addr, char *buf_func, size_t buf_func_len,
		char *buf_file, size_t buf_file_len);

static const char *program_name = "addr2line";

void bfd_nonfatal (const char *string)
{
	const char *errmsg = bfd_errmsg(bfd_get_error());

	if (string)
		fprintf(stderr, "%s: %s: %s\n", program_name, string, errmsg);
	else
		fprintf(stderr, "%s: %s\n", program_name, errmsg);
}

void report (const char * format, va_list args)
{
	fprintf(stderr, "%s: ", program_name);
	vfprintf(stderr, format, args);
	putc('\n', stderr);
}

void non_fatal (const char *format, ...)
{
	va_list args;

	va_start(args, format);
	report(format, args);
	va_end(args);
}

/** Returns the size of the named file.  If the file does not
 * exist, or if it is not a real file, then a suitable non-fatal
 * error message is printed and zero is returned. */
off_t get_file_size (const char * file_name)
{
	struct stat statbuf;

	if (stat(file_name, &statbuf) < 0) {
		if (errno == ENOENT)
			non_fatal("'%s': No such file", file_name);
		else
			non_fatal("Warning: could not locate '%s'.  reason: %s", file_name, strerror(errno));
	} else if (!S_ISREG (statbuf.st_mode))
		non_fatal("Warning: '%s' is not an ordinary file", file_name);
	else
		return statbuf.st_size;

	return 0;
}

/** After a FALSE return from bfd_check_format_matches with
 * bfd_get_error () == bfd_error_file_ambiguously_recognized, print
 * the possible matching targets. */
void list_matching_formats (char **p)
{
	if (!p || !*p)
		return;

	fprintf(stderr, "%s: Matching formats: ", program_name);
	while (*p)
		fprintf(stderr, " %s", *p++);
	fputc('\n', stderr);
}

/** Set the default BFD target based on the configured target.  Doing
 * this permits the binutils to be configured for a particular target,
 * and linked against a shared BFD library which was configured for a
 * different target. */
void set_default_bfd_target (void)
{
	/* The macro TARGET is defined by Makefile.
	 E.g.: -DTARGET='"i686-pc-linux-gnu"'.  */
	const char *target = TARGET;

	if (!bfd_set_default_target(target)) {
		non_fatal("can't set BFD default target to `%s': %s", target, bfd_errmsg(bfd_get_error()));
		return;
	}

	return;
}

/** Read in the symbol table. */
static int slurp_symtab (bfd *abfd)
{
	long symcount;
	unsigned int size;

	if ((bfd_get_file_flags(abfd) & HAS_SYMS) == 0)
		return -1;

	symcount = bfd_read_minisymbols(abfd, FALSE, (void *) &m_libtrace_data.syms, &size);
	if (symcount == 0)
		symcount = bfd_read_minisymbols(abfd, TRUE /* dynamic */, (void *) &m_libtrace_data.syms, &size);

	if (symcount < 0) {
		bfd_nonfatal(bfd_get_filename(abfd));
		return -1;
	}

	return 0;
}

/** Look for an address in a section.  This is called via
 * bfd_map_over_sections. */
static void find_address_in_section (bfd *abfd, asection *section, void *data)
{
	bfd_vma vma;
	bfd_size_type size;
	sym_info *psi = (sym_info*) data;

	if (psi->found)
		return;

	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
		return;

	vma = bfd_get_section_vma(abfd, section);
	if (psi->pc < vma)
		return;

	size = bfd_get_section_size(section);
	if (psi->pc >= vma + size)
		return;

	psi->found = bfd_find_nearest_line(abfd, section, m_libtrace_data.syms, psi->pc - vma, &psi->filename,
			&psi->functionname, &psi->line);
}

/** Look for an offset in a section.  This is directly called. */
static void find_offset_in_section (bfd *abfd, asection *section, sym_info *psi)
{
	bfd_size_type size;

	if (psi->found)
		return;

	if ((bfd_get_section_flags(abfd, section) & SEC_ALLOC) == 0)
		return;

	size = bfd_get_section_size(section);
	if (psi->pc >= size)
		return;

	psi->found = bfd_find_nearest_line(abfd, section, m_libtrace_data.syms, psi->pc, &psi->filename,
			&psi->functionname, &psi->line);
}

/** Translate xaddr into
 * file_name:line_number and optionally function name. */
static int translate_addresses (bfd *abfd, asection *section, void *xaddr, char *buf_func, size_t buf_func_len,
		char *buf_file, size_t buf_file_len)
{
#define ADDR_BUF_LEN ((CHAR_BIT/4)*(sizeof(void*))+1)
	char addr[ADDR_BUF_LEN + 1] = { 0 };
	sym_info si = { 0 };

	sprintf(addr, "%p", xaddr);
	si.pc = bfd_scan_vma(addr, nullptr, 16);

	si.found = FALSE;
	if (section)
		find_offset_in_section(abfd, section, &si);
	else
		bfd_map_over_sections(abfd, find_address_in_section, &si);

	if (!si.found) {
		if (buf_func != nullptr)
			snprintf(buf_func, buf_func_len, "%s ??:0", m_libtrace_data.with_functions ? "??" : "");
	} else {
		do {
			if (m_libtrace_data.with_functions) {
				const char *name;
				char *alloc = nullptr;

				name = si.functionname;
				if (name == nullptr || *name == '\0')
					name = "??";
				else if (m_libtrace_data.do_demangle) {
					alloc = bfd_demangle(abfd, name, DMGL_ANSI | DMGL_PARAMS);
					if (alloc != nullptr)
						name = alloc;
				}

				if (buf_func != nullptr)
					snprintf(buf_func, buf_func_len, "%s", name);

				free(alloc);
			}

			if (m_libtrace_data.base_names && si.filename != nullptr) {
				char *h = strrchr(si.filename, '/');
				if (h != nullptr)
					si.filename = h + 1;
			}

			if (buf_file != nullptr)
				snprintf(buf_file, buf_file_len, "%s:%u", si.filename ? si.filename : "??", si.line);
			if (!m_libtrace_data.unwind_inlines)
				si.found = FALSE;
			else
				si.found = bfd_find_inliner_info(abfd, &si.filename, &si.functionname, &si.line);
		} while (si.found);
	}

	return si.found;
}
/* --------------------------------------------------------------- */

int libtrace_init (const char *file_name, const char *section_name, const char *target)
{
	char **matching = nullptr;

	bfd_init();
	set_default_bfd_target();

	if (get_file_size(file_name) < 1)
		return -1;

	m_libtrace_data.abfd = bfd_openr(file_name, target);
	if (m_libtrace_data.abfd == nullptr) {
		bfd_nonfatal(file_name);
		return -1;
	}

	if (bfd_check_format(m_libtrace_data.abfd, bfd_archive)) {
		non_fatal("%s: cannot get addresses from archive", file_name);
		return -1;
	}

	if (!bfd_check_format_matches(m_libtrace_data.abfd, bfd_object, &matching)) {
		bfd_nonfatal(bfd_get_filename(m_libtrace_data.abfd));
		if (bfd_get_error() == bfd_error_file_ambiguously_recognized) {
			list_matching_formats(matching);
			free(matching);
		}
		return -1;
	}

	if (section_name != nullptr) {
		m_libtrace_data.section = bfd_get_section_by_name(m_libtrace_data.abfd, section_name);
		if (m_libtrace_data.section == nullptr)
			non_fatal("%s: cannot find section %s", file_name, section_name);
	} else
		m_libtrace_data.section = nullptr;

	if (0 != slurp_symtab(m_libtrace_data.abfd))
		return -1;

	return 0;
}

int libtrace_close (void)
{
	free(m_libtrace_data.syms);
	m_libtrace_data.syms = nullptr;

	bfd_close(m_libtrace_data.abfd);

	return 0;
}

int libtrace_resolve (void *addr, char *buf_func, size_t buf_func_len, char *buf_file, size_t buf_file_len, ...)
{
	int ret = FALSE;
	ret = translate_addresses(m_libtrace_data.abfd, m_libtrace_data.section, addr, buf_func, buf_func_len, buf_file,
			buf_file_len);
	assert(0 == ret);

	return 0;
}

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

#ifdef MAIN_FUNC
static void usage (FILE *stream, int status)
{
	fprintf(stream, "Usage: %s image addr <addr...>\n", program_name);
	fprintf(stream, "Ex: %s cpptraced 0x8048f0e 0x8048fd4 \n", program_name);
	/*
	 list_supported_targets(program_name, stream). e.g.:
	 elf32-i386    a.out-i386-linux  efi-app-ia32
	 elf32-little  elf32-big         elf64-x86-64
	 elf64-little  elf64-big srec    symbolsrec
	 tekhex        binary            ihex
	 trad-core
	 */
	exit(status);
}

int main (int argc, char **argv)
{
	const char *file_name = nullptr;
	const char *section_name = nullptr;
	char *target = nullptr;

#if defined (HAVE_SETLOCALE) && defined (HAVE_LC_MESSAGES)
	setlocale (LC_MESSAGES, "");
#endif
#if defined (HAVE_SETLOCALE)
	setlocale (LC_CTYPE, "");
#endif
	/*  bindtextdomain(PACKAGE, LOCALEDIR);*/
	/*  textdomain(PACKAGE);*/
	/*  expandargv(&argc, &argv); /*libiberty*/

	if (argc < 3) {
		usage(stderr, 1);
	}

	file_name = argv[1];

#define FUNC_MAX (PATH_MAX)
	if (0 == libtrace_init(file_name, section_name, target)) {
		int i;
		void *sym = nullptr;
		char func[FUNC_MAX + 1] = { 0 };
		char file[PATH_MAX + 1] = { 0 };

		for (i = argc - 2; i < argc; i++) {
			sscanf(argv[i], "%p", &sym);
			libtrace_resolve(sym, func, FUNC_MAX, file, PATH_MAX);
			printf("%s [%s]\n", func, file);
		}

		libtrace_close();
		return EXIT_SUCCESS;
	}

	return EXIT_FAILURE;
}
#endif /*MAIN_FUNC*/


/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#pragma once

#include <faiss/IndexReplicas.h>
#include <faiss/gpu/StandardGpuResources.h>
#include <functional>
#include <memory>
#include <vector>

namespace faiss { namespace gpu {

// If we want to run multi-GPU, create a proxy to wrap the indices.
// If we don't want multi-GPU, don't involve the proxy, so it doesn't
// affect the timings.
template <typename GpuIndex>
struct IndexWrapper {
  std::vector<std::unique_ptr<faiss::gpu::StandardGpuResources>> resources;
  std::vector<std::unique_ptr<GpuIndex>> subIndex;
  std::unique_ptr<faiss::IndexReplicas> replicaIndex;

  IndexWrapper(
    int numGpus,
    std::function<std::unique_ptr<GpuIndex>(GpuResourcesProvider*, int)> init);
  faiss::Index* getIndex();

  void runOnIndices(std::function<void(GpuIndex*)> f);
  void setNumProbes(int nprobe);
};

} }

#include <faiss/gpu/perf/IndexWrapper-inl.h>


/**
 * Marlin 3D Printer Firmware
 * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
 *
 * Based on Sprinter and grbl.
 * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#if !defined(__AVR_ATmega1281__) && !defined(__AVR_ATmega2561__)
  #error "Oops! Select 'Silvergate' in 'Tools > Board.'"
#endif

#define BOARD_NAME "Silver Gate"

#define X_STEP_PIN         43
#define X_DIR_PIN          44
#define X_ENABLE_PIN       42
#define X_MIN_PIN          31
#define X_MAX_PIN          34

#define Y_STEP_PIN         40
#define Y_DIR_PIN          41
#define Y_ENABLE_PIN       39
#define Y_MIN_PIN          32
#define Y_MAX_PIN          35

#define Z_STEP_PIN         13
#define Z_DIR_PIN          38
#define Z_ENABLE_PIN       14
#define Z_MIN_PIN          33
#define Z_MAX_PIN          36

#define E0_STEP_PIN        27
#define E0_DIR_PIN         37
#define E0_ENABLE_PIN      45

#define SDSS               16

#ifndef FIL_RUNOUT_PIN
  #define FIL_RUNOUT_PIN   34   // X_MAX unless overridden
#endif

#ifndef FAN_PIN
  #define FAN_PIN           5
#endif

#define HEATER_0_PIN        7

#define ORIG_E0_AUTO_FAN_PIN 3   // Use this by NOT overriding E0_AUTO_FAN_PIN
#define CONTROLLER_FAN_PIN  2

#define TEMP_0_PIN          7   // Analog Input

#define HEATER_BED_PIN      8
#define TEMP_BED_PIN        6

#if ENABLED(DOGLCD)
  #if ENABLED(U8GLIB_ST7920)    // SPI GLCD 12864 ST7920
    #define LCD_PINS_RS    30
    #define LCD_PINS_ENABLE 20
    #define LCD_PINS_D4    25
    #define BEEPER_PIN     29
    #define BTN_EN1        19
    #define BTN_EN2        22
    #define BTN_ENC        24
    #define LCD_BACKLIGHT_PIN  6
    #if ENABLED(SILVER_GATE_GLCD_CONTROLLER)
      #define KILL_PIN     21
      #define HOME_PIN     28
    #endif
  #endif
#endif

#define SD_DETECT_PIN      15

#define STAT_LED_RED_PIN   23
#define STAT_LED_BLUE_PIN  26
#define CASE_LIGHT_PIN     51


StartTest(function(t) {

    t.is(1, 1, 'Correct')
    t.isnt(1, 2, 'Correct')
    t.ok(1, 'Correct')
    t.notOk(0, 'Correct')

    t.isStrict(null, null, 'Correct')

    t.like('Yo', /yo/i, 'Correct')

    t.throwsOk(function () { throw "yo" }, /yo/, 'Exception thrown')
    t.livesOk(function () { }, 'Exception not thrown')

    t.isDeeplyStrict({ a : 1, b : 2 }, { a : 1, b : 2 }, 'Correct')
})


    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="xbsj-labels" content="Earth示例">
    </meta>
    <title>模型-位置匹配</title>

        <earth-comp></earth-comp>


<IfModule mpm_event_module>
  StartServers          2
  MinSpareThreads      25
  MaxSpareThreads      75
  ThreadLimit          64
  ThreadsPerChild      25
  MaxClients          150
  MaxRequestsPerChild   0
</IfModule>


This patch fixes compiling xinetd without RPC support.

The content of this patch was copied from the OpenWrt project:
https://dev.openwrt.org/browser/packages/net/xinetd/patches/003-rpc_fix.patch

Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

--- a/xinetd/confparse.c
+++ b/xinetd/confparse.c
@@ -745,7 +745,7 @@ static status_e check_entry( struct serv
 	   }
    }

-/* #ifndef NO_RPC */
+#ifndef NO_RPC
 #if defined(HAVE_RPC_RPCENT_H) || defined(HAVE_NETDB_H)
    if ( SC_IS_RPC( scp ) && !SC_IS_UNLISTED( scp ) )
    {
@@ -759,6 +759,7 @@ static status_e check_entry( struct serv
       SC_RPCDATA( scp )->rd_program_number = rep->r_number ;
    }
    else
+#endif
 #endif   /* ! NO_RPC */
    {
        if ( !SC_IS_UNLISTED( scp ) )


define( [
	"../core",
	"../core/access",
	"./support",
	"../var/rnotwhite",
	"../selector"
], function( jQuery, access, support, rnotwhite ) {

"use strict";

var boolHook,
	attrHandle = jQuery.expr.attrHandle;

jQuery.fn.extend( {
	attr: function( name, value ) {
		return access( this, jQuery.attr, name, value, arguments.length > 1 );
	},

	removeAttr: function( name ) {
		return this.each( function() {
			jQuery.removeAttr( this, name );
		} );
	}
} );

jQuery.extend( {
	attr: function( elem, name, value ) {
		var ret, hooks,
			nType = elem.nodeType;

		// Don't get/set attributes on text, comment and attribute nodes
		if ( nType === 3 || nType === 8 || nType === 2 ) {
			return;
		}

		// Fallback to prop when attributes are not supported
		if ( typeof elem.getAttribute === "undefined" ) {
			return jQuery.prop( elem, name, value );
		}

		// Attribute hooks are determined by the lowercase version
		// Grab necessary hook if one is defined
		if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) {
			hooks = jQuery.attrHooks[ name.toLowerCase() ] ||
				( jQuery.expr.match.bool.test( name ) ? boolHook : undefined );
		}

		if ( value !== undefined ) {
			if ( value === null ) {
				jQuery.removeAttr( elem, name );
				return;
			}

			if ( hooks && "set" in hooks &&
				( ret = hooks.set( elem, value, name ) ) !== undefined ) {
				return ret;
			}

			elem.setAttribute( name, value + "" );
			return value;
		}

		if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) {
			return ret;
		}

		ret = jQuery.find.attr( elem, name );

		// Non-existent attributes return null, we normalize to undefined
		return ret == null ? undefined : ret;
	},

	attrHooks: {
		type: {
			set: function( elem, value ) {
				if ( !support.radioValue && value === "radio" &&
					jQuery.nodeName( elem, "input" ) ) {
					var val = elem.value;
					elem.setAttribute( "type", value );
					if ( val ) {
						elem.value = val;
					}
					return value;
				}
			}
		}
	},

	removeAttr: function( elem, value ) {
		var name,
			i = 0,
			attrNames = value && value.match( rnotwhite );

		if ( attrNames && elem.nodeType === 1 ) {
			while ( ( name = attrNames[ i++ ] ) ) {
				elem.removeAttribute( name );
			}
		}
	}
} );

// Hooks for boolean attributes
boolHook = {
	set: function( elem, value, name ) {
		if ( value === false ) {

			// Remove boolean attributes when set to false
			jQuery.removeAttr( elem, name );
		} else {
			elem.setAttribute( name, name );
		}
		return name;
	}
};

jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) {
	var getter = attrHandle[ name ] || jQuery.find.attr;

	attrHandle[ name ] = function( elem, name, isXML ) {
		var ret, handle,
			lowercaseName = name.toLowerCase();

		if ( !isXML ) {

			// Avoid an infinite loop by temporarily removing this function from the getter
			handle = attrHandle[ lowercaseName ];
			attrHandle[ lowercaseName ] = ret;
			ret = getter( elem, name, isXML ) != null ?
				lowercaseName :
				null;
			attrHandle[ lowercaseName ] = handle;
		}
		return ret;
	};
} );

} );


using System;
using SLua;
using System.Collections.Generic;
[UnityEngine.Scripting.Preserve]
public class Lua_UnityEngine_UI_Selectable : LuaObject {
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int IsInteractable(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			var ret=self.IsInteractable();
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int FindSelectable(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.Vector3 a1;
			checkType(l,2,out a1);
			var ret=self.FindSelectable(a1);
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int FindSelectableOnLeft(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			var ret=self.FindSelectableOnLeft();
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int FindSelectableOnRight(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			var ret=self.FindSelectableOnRight();
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int FindSelectableOnUp(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			var ret=self.FindSelectableOnUp();
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int FindSelectableOnDown(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			var ret=self.FindSelectableOnDown();
			pushValue(l,true);
			pushValue(l,ret);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnMove(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.AxisEventData a1;
			checkType(l,2,out a1);
			self.OnMove(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnPointerDown(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.PointerEventData a1;
			checkType(l,2,out a1);
			self.OnPointerDown(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnPointerUp(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.PointerEventData a1;
			checkType(l,2,out a1);
			self.OnPointerUp(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnPointerEnter(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.PointerEventData a1;
			checkType(l,2,out a1);
			self.OnPointerEnter(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnPointerExit(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.PointerEventData a1;
			checkType(l,2,out a1);
			self.OnPointerExit(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnSelect(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.BaseEventData a1;
			checkType(l,2,out a1);
			self.OnSelect(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int OnDeselect(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.EventSystems.BaseEventData a1;
			checkType(l,2,out a1);
			self.OnDeselect(a1);
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int Select(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			self.Select();
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_allSelectables(IntPtr l) {
		try {
			pushValue(l,true);
			pushValue(l,UnityEngine.UI.Selectable.allSelectables);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_navigation(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.navigation);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_navigation(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.Navigation v;
			checkValueType(l,2,out v);
			self.navigation=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_transition(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushEnum(l,(int)self.transition);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_transition(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.Selectable.Transition v;
			checkEnum(l,2,out v);
			self.transition=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_colors(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.colors);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_colors(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.ColorBlock v;
			checkValueType(l,2,out v);
			self.colors=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_spriteState(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.spriteState);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_spriteState(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.SpriteState v;
			checkValueType(l,2,out v);
			self.spriteState=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_animationTriggers(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.animationTriggers);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_animationTriggers(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.AnimationTriggers v;
			checkType(l,2,out v);
			self.animationTriggers=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_targetGraphic(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.targetGraphic);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_targetGraphic(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.Graphic v;
			checkType(l,2,out v);
			self.targetGraphic=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_interactable(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.interactable);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_interactable(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			bool v;
			checkType(l,2,out v);
			self.interactable=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_image(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.image);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int set_image(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			UnityEngine.UI.Image v;
			checkType(l,2,out v);
			self.image=v;
			pushValue(l,true);
			return 1;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[MonoPInvokeCallbackAttribute(typeof(LuaCSFunction))]
	[UnityEngine.Scripting.Preserve]
	static public int get_animator(IntPtr l) {
		try {
			UnityEngine.UI.Selectable self=(UnityEngine.UI.Selectable)checkSelf(l);
			pushValue(l,true);
			pushValue(l,self.animator);
			return 2;
		}
		catch(Exception e) {
			return error(l,e);
		}
	}
	[UnityEngine.Scripting.Preserve]
	static public void reg(IntPtr l) {
		getTypeTable(l,"UnityEngine.UI.Selectable");
		addMember(l,IsInteractable);
		addMember(l,FindSelectable);
		addMember(l,FindSelectableOnLeft);
		addMember(l,FindSelectableOnRight);
		addMember(l,FindSelectableOnUp);
		addMember(l,FindSelectableOnDown);
		addMember(l,OnMove);
		addMember(l,OnPointerDown);
		addMember(l,OnPointerUp);
		addMember(l,OnPointerEnter);
		addMember(l,OnPointerExit);
		addMember(l,OnSelect);
		addMember(l,OnDeselect);
		addMember(l,Select);
		addMember(l,"allSelectables",get_allSelectables,null,false);
		addMember(l,"navigation",get_navigation,set_navigation,true);
		addMember(l,"transition",get_transition,set_transition,true);
		addMember(l,"colors",get_colors,set_colors,true);
		addMember(l,"spriteState",get_spriteState,set_spriteState,true);
		addMember(l,"animationTriggers",get_animationTriggers,set_animationTriggers,true);
		addMember(l,"targetGraphic",get_targetGraphic,set_targetGraphic,true);
		addMember(l,"interactable",get_interactable,set_interactable,true);
		addMember(l,"image",get_image,set_image,true);
		addMember(l,"animator",get_animator,null,true);
		createTypeMetatable(l,null, typeof(UnityEngine.UI.Selectable),typeof(UnityEngine.EventSystems.UIBehaviour));
	}
}


#
# Prompt character
#

# ------------------------------------------------------------------------------
# Configuration
# ------------------------------------------------------------------------------

SPACESHIP_CHAR_PREFIX="${SPACESHIP_CHAR_PREFIX=""}"
SPACESHIP_CHAR_SUFFIX="${SPACESHIP_CHAR_SUFFIX=""}"
SPACESHIP_CHAR_SYMBOL="${SPACESHIP_CHAR_SYMBOL="➜ "}"
SPACESHIP_CHAR_SYMBOL_ROOT="${SPACESHIP_CHAR_SYMBOL_ROOT="$SPACESHIP_CHAR_SYMBOL"}"
SPACESHIP_CHAR_SYMBOL_SECONDARY="${SPACESHIP_CHAR_SYMBOL_SECONDARY="$SPACESHIP_CHAR_SYMBOL"}"
SPACESHIP_CHAR_COLOR_SUCCESS="${SPACESHIP_CHAR_COLOR_SUCCESS="green"}"
SPACESHIP_CHAR_COLOR_FAILURE="${SPACESHIP_CHAR_COLOR_FAILURE="red"}"
SPACESHIP_CHAR_COLOR_SECONDARY="${SPACESHIP_CHAR_COLOR_SECONDARY="yellow"}"

# ------------------------------------------------------------------------------
# Section
# ------------------------------------------------------------------------------

# Paint $PROMPT_SYMBOL in red if previous command was fail and
# paint in green if everything was OK.
spaceship_char() {
  local 'color' 'char'

  if [[ $RETVAL -eq 0 ]]; then
    color="$SPACESHIP_CHAR_COLOR_SUCCESS"
  else
    color="$SPACESHIP_CHAR_COLOR_FAILURE"
  fi

  if [[ $UID -eq 0 ]]; then
    char="$SPACESHIP_CHAR_SYMBOL_ROOT"
  else
    char="$SPACESHIP_CHAR_SYMBOL"
  fi

  spaceship::section \
    "$color" \
    "$SPACESHIP_CHAR_PREFIX" \
    "$char" \
    "$SPACESHIP_CHAR_SUFFIX"
}


/*
 * Copyright (c) 1997, 2018 Oracle and/or its affiliates. All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v. 2.0, which is available at
 * http://www.eclipse.org/legal/epl-2.0.
 *
 * This Source Code may also be made available under the following Secondary
 * Licenses when the conditions for such availability set forth in the
 * Eclipse Public License v. 2.0 are satisfied: GNU General Public License,
 * version 2 with the GNU Classpath Exception, which is available at
 * https://www.gnu.org/software/classpath/license.html.
 *
 * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
 */

package org.glassfish.tests.utils;

import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.Principal;
import java.security.PrivilegedAction;
import java.util.List;
import java.util.Set;
import javax.security.auth.Subject;
import javax.xml.stream.XMLStreamReader;

import org.glassfish.hk2.api.Filter;
import org.glassfish.hk2.api.ServiceLocator;
import org.junit.Ignore;
import org.jvnet.hk2.config.ConfigBean;
import org.jvnet.hk2.config.ConfigModel;
import org.jvnet.hk2.config.DomDocument;
import org.jvnet.hk2.config.Transactions;
import static org.junit.Assert.*;

import java.util.logging.Logger;
import org.glassfish.hk2.api.Descriptor;
import org.glassfish.hk2.api.ServiceHandle;

/**
 * Super class for all config-api related tests, give access to a configured habitat
 */
@Ignore
public abstract class ConfigApiTest {

    public static final Logger logger = Logger.getAnonymousLogger();

    private final Subject adminSubject = prepareAdminSubject();

    private Subject prepareAdminSubject() {
        final ServiceLocator locator = getBaseServiceLocator();
        if (locator != null) {
            final List<ServiceHandle<? extends Object>> adminIdentities =
/*
                    (List<ServiceHandle<? extends Object>>) getBaseServiceLocator().getAllServices(
                    new Filter() {

                @Override
                public boolean matches(Descriptor d) {
                    if (d == null) {
                        return false;
                    }
                    final Set<String> contracts = d.getAdvertisedContracts();
                    return (contracts == null ? false : contracts.contains("org.glassfish.internal.api.InternalSystemAdmin"));
                }
            });
*/
                AccessController.doPrivileged(new PrivilegedAction<List<ServiceHandle<? extends Object>>>() {
                    public List<ServiceHandle<? extends Object>> run() {

                        List<ServiceHandle<? extends Object>> identities = (List<ServiceHandle<? extends Object>>)getBaseServiceLocator().getAllServices(
                           new Filter() {

                                @Override
                                public boolean matches(Descriptor d) {
                                   if (d == null) {
                                   return false;
                                }
                                final Set<String> contracts = d.getAdvertisedContracts();
                                return (contracts == null ? false : contracts.contains("org.glassfish.internal.api.InternalSystemAdmin"));
                              }
                           });

                        return identities;

                    }
                });

            if ( ! adminIdentities.isEmpty()) {
                final Object adminIdentity = adminIdentities.get(0);
                try {
                    final Method getSubjectMethod = adminIdentity.getClass().getDeclaredMethod("getSubject", Subject.class);
                    return (Subject) getSubjectMethod.invoke(adminIdentity);
                } catch (Exception ex) {
                    // ignore - fallback to creating a subject explicitly that
                    // should match the GlassFish admin identity
                }
            }
        }
        final Subject s = new Subject();
        s.getPrincipals().add(new PrincipalImpl("asadmin"));
        s.getPrincipals().add(new PrincipalImpl("_InternalSystemAdministrator_"));
        return s;
    }

    private static class PrincipalImpl implements Principal {
        private final String name;

        private PrincipalImpl(final String name) {
            this.name = name;
        }
        @Override
        public String getName() {
            return name;
        }
    }

    protected Subject adminSubject() {
        return adminSubject;
    }

    /**
     * Returns the file name without the .xml extension to load the test configuration
     * from. By default, it's the name of the TestClass.
     *
     * @return the configuration file name
     */
    public String getFileName() {
        return getClass().getName().substring(getClass().getName().lastIndexOf('.')+1);
    }

    /**
     * Returns a configured Habitat with the configuration.
     *
     * @return a configured Habitat
     */
    public ServiceLocator getHabitat() {
        ServiceLocator habitat = Utils.instance.getHabitat(this);

        assertNotNull("Transactions service from Configuration subsystem is null", habitat.getService(Transactions.class));
        return habitat;
    }

    public ServiceLocator getBaseServiceLocator() {
        return getHabitat();
    }

    /**
     *  Override it when needed, see config-api/ConfigApiTest.java for example.
     */
    public DomDocument getDocument(ServiceLocator habitat) {
        TestDocument doc = habitat.getService(TestDocument.class);
        if (doc == null) {
            doc = new TestDocument(habitat);
        }
        return doc;
    }

    class TestDocument extends DomDocument<ConfigBean> {

        public TestDocument(ServiceLocator habitat) {
            super(habitat);
        }

        @Override
        public ConfigBean make(final ServiceLocator habitat, XMLStreamReader xmlStreamReader,
                ConfigBean dom, ConfigModel configModel) {
            return new ConfigBean(habitat,this, dom, configModel, xmlStreamReader);
        }
    }

    /*
     * Decorate the habitat after parsing.  This is called on the habitat
     * just after parsing of the XML file is complete.
     */
    public void decorate(ServiceLocator habitat) {}
}


socket.io
=========

#### Sockets for the rest of us

The `socket.io` client is basically a simple HTTP Socket interface implementation.
It looks similar to WebSocket while providing additional features and
leveraging other transports when WebSocket is not supported by the user's
browser.

```js
var socket = io.connect('http://domain.com');
socket.on('connect', function () {
  // socket connected
});
socket.on('custom event', function () {
  // server emitted a custom event
});
socket.on('disconnect', function () {
  // socket disconnected
});
socket.send('hi there');
```

### Recipes

#### Utilizing namespaces (ie: multiple sockets)

If you want to namespace all the messages and events emitted to a particular
endpoint, simply specify it as part of the `connect` uri:

```js
var chat = io.connect('http://localhost/chat');
chat.on('connect', function () {
  // chat socket connected
});

var news = io.connect('/news'); // io.connect auto-detects host
news.on('connect', function () {
  // news socket connected
});
```

#### Emitting custom events

To ease with the creation of applications, you can emit custom events outside
of the global `message` event.

```js
var socket = io.connect();
socket.emit('server custom event', { my: 'data' });
```

#### Forcing disconnection

```js
var socket = io.connect();
socket.on('connect', function () {
  socket.disconnect();
});
```

### Documentation

#### io#connect

```js
io.connect(uri, [options]);
```

##### Options:

- *resource*

    socket.io

  The resource is what allows the `socket.io` server to identify incoming connections by `socket.io` clients. In other words, any HTTP server can implement socket.io and still serve other normal, non-realtime HTTP requests.

- *transports*

```js
['websocket', 'flashsocket', 'htmlfile', 'xhr-multipart', 'xhr-polling', 'jsonp-polling']
```

  A list of the transports to attempt to utilize (in order of preference).

- *'connect timeout'*

```js
5000
```

  The amount of milliseconds a transport has to create a connection before we consider it timed out.

- *'try multiple transports'*

```js
true
```

  A boolean indicating if we should try other transports when the  connectTimeout occurs.

- *reconnect*

```js
true
```

  A boolean indicating if we should automatically reconnect if a connection is disconnected.

- *'reconnection delay'*

```js
500
```

  The amount of milliseconds before we try to connect to the server again. We are using a exponential back off algorithm for the following reconnections, on each reconnect attempt this value will get multiplied (500 > 1000 > 2000 > 4000 > 8000).

- *'max reconnection attempts'*

```js
10
```

  The amount of attempts should we make using the current transport to connect to the server? After this we will do one final attempt, and re-try with all enabled transport methods before we give up.

##### Properties:

- *options*

  The passed in options combined with the defaults.

- *connected*

  Whether the socket is connected or not.

- *connecting*

  Whether the socket is connecting or not.

- *reconnecting*

  Whether we are reconnecting or not.

- *transport*

  The transport instance.

##### Methods:

- *connect(λ)*

  Establishes a connection. If λ is supplied as argument, it will be called once the connection is established.

- *send(message)*

  A string of data to send.

- *disconnect*

  Closes the connection.

- *on(event, λ)*

  Adds a listener for the event *event*.

- *once(event, λ)*

  Adds a one time listener for the event *event*. The listener is removed after the first time the event is fired.

- *removeListener(event, λ)*

  Removes the listener λ for the event *event*.

##### Events:

- *connect*

  Fired when the connection is established and the handshake successful.

- *connecting(transport_type)*

    Fired when a connection is attempted, passing the transport name.

- *connect_failed*

    Fired when the connection timeout occurs after the last connection attempt.
  This only fires if the `connectTimeout` option is set.
  If the `tryTransportsOnConnectTimeout` option is set, this only fires once all
  possible transports have been tried.

- *message(message)*

  Fired when a message arrives from the server

- *close*

  Fired when the connection is closed. Be careful with using this event, as some transports will fire it even under temporary, expected disconnections (such as XHR-Polling).

- *disconnect*

  Fired when the connection is considered disconnected.

- *reconnect(transport_type,reconnectionAttempts)*

  Fired when the connection has been re-established. This only fires if the `reconnect` option is set.

- *reconnecting(reconnectionDelay,reconnectionAttempts)*

  Fired when a reconnection is attempted, passing the next delay for the next reconnection.

- *reconnect_failed*

  Fired when all reconnection attempts have failed and we where unsuccessful in reconnecting to the server.

### Contributors

Guillermo Rauch <guillermo@learnboost.com>

Arnout Kazemier <info@3rd-eden.com>

### License

(The MIT License)

Copyright (c) 2010 LearnBoost <dev@learnboost.com>

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.