text:
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

#include <rtems/imfs.h>
#include <rtems/malloc.h>
#include <rtems/libcsupport.h>

#include <sys/stat.h>

#include <net/if.h>

#include <assert.h>
#include <fcntl.h>
#include <ifaddrs.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>

#include <machine/rtems-bsd-commands.h>

#include <rtems.h>
#include <rtems/stackchk.h>
#include <rtems/bsd/bsd.h>

#if defined(DEFAULT_NETWORK_DHCPCD_ENABLE) && \
    !defined(DEFAULT_NETWORK_NO_STATIC_IFCONFIG)
#define DEFAULT_NETWORK_NO_STATIC_IFCONFIG
#endif

#ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
#include <bsp.h>

#if defined(LIBBSP_ARM_ALTERA_CYCLONE_V_BSP_H)
  #define NET_CFG_INTERFACE_0 "dwc0"
#elif defined(LIBBSP_ARM_REALVIEW_PBX_A9_BSP_H)
  #define NET_CFG_INTERFACE_0 "smc0"
#elif defined(LIBBSP_ARM_XILINX_ZYNQ_BSP_H)
  #define NET_CFG_INTERFACE_0 "cgem0"
#elif defined(__GENMCF548X_BSP_H)
  #define NET_CFG_INTERFACE_0 "fec0"
#else
  #define NET_CFG_INTERFACE_0 "lo0"
#endif

#endif

#ifdef DEFAULT_NETWORK_SHELL
#include <rtems/console.h>
#include <rtems/shell.h>
#endif

#include "filesystem.h"

typedef enum {
  TEST_NEW,
  TEST_INITIALIZED,
  TEST_FSTAT_OPEN_0,
  TEST_FSTAT_OPEN_1,
  TEST_OPEN,
  TEST_READ,
  TEST_WRITE,
  TEST_IOCTL,
  TEST_LSEEK,
  TEST_FTRUNCATE,
  TEST_FSYNC,
  TEST_FDATASYNC,
  TEST_FCNTL,
  TEST_READV,
  TEST_WRITEV,
  TEST_CLOSED,
  TEST_FSTAT_UNLINK,
  TEST_REMOVED,
  TEST_DESTROYED
} test_state;

static int handler_open(
  rtems_libio_t *iop,
  const char *path,
  int oflag,
  mode_t mode
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

 //rtems_test_assert(*state == TEST_FSTAT_OPEN_1);
  *state = TEST_OPEN;

  return 0;
}

static int handler_close(
  rtems_libio_t *iop
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_WRITEV);
  *state = TEST_CLOSED;

  return 0;
}

static ssize_t handler_read(
  rtems_libio_t *iop,
  void *buffer,
  size_t count
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_OPEN);
  *state = TEST_READ;

  return 0;
}

static ssize_t handler_write(
  rtems_libio_t *iop,
  const void *buffer,
  size_t count
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_READ);
  *state = TEST_WRITE;

  return 0;
}

static int handler_ioctl(
  rtems_libio_t *iop,
  uint32_t request,
  void *buffer
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_WRITE);
  *state = TEST_IOCTL;

  return 0;
}

static off_t handler_lseek(
  rtems_libio_t *iop,
  off_t length,
  int whence
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_IOCTL);
  *state = TEST_LSEEK;

  return 0;
}

static int handler_fstat(
  const rtems_filesystem_location_info_t *loc,
  struct stat *buf
)
{
  test_state *state = IMFS_generic_get_context_by_location(loc);

  switch (*state) {
    case TEST_INITIALIZED:
      *state = TEST_FSTAT_OPEN_0;
      break;
    case TEST_FSTAT_OPEN_0:
      *state = TEST_FSTAT_OPEN_1;
      break;
    case TEST_CLOSED:
      *state = TEST_FSTAT_UNLINK;
      break;
    default:
      printk("x\n");
      //rtems_test_assert(0);
      break;
  }

  buf->st_mode = S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO;

  return 0;
}

static int handler_ftruncate(
  rtems_libio_t *iop,
  off_t length
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_LSEEK);
  *state = TEST_FTRUNCATE;

  return 0;
}

static int handler_fsync(
  rtems_libio_t *iop
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_FTRUNCATE);
  *state = TEST_FSYNC;

  return 0;
}

static int handler_fdatasync(
  rtems_libio_t *iop
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_FSYNC);
  *state = TEST_FDATASYNC;

  return 0;
}

static int handler_fcntl(
  rtems_libio_t *iop,
  int cmd
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_FDATASYNC);
  *state = TEST_FCNTL;

  return 0;
}

static ssize_t handler_readv(
  rtems_libio_t *iop,
  const struct iovec *iov,
  int iovcnt,
  ssize_t total
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_FCNTL);
  *state = TEST_READV;

  return 0;
}

static ssize_t handler_writev(
  rtems_libio_t *iop,
  const struct iovec *iov,
  int iovcnt,
  ssize_t total
)
{
  test_state *state = IMFS_generic_get_context_by_iop(iop);

  //rtems_test_assert(*state == TEST_READV);
  *state = TEST_WRITEV;

  return 0;
}

static const rtems_filesystem_file_handlers_r node_handlers = {
  .open_h = handler_open,
  .close_h = handler_close,
  .read_h = handler_read,
  .write_h = handler_write,
  .ioctl_h = handler_ioctl,
  .lseek_h = handler_lseek,
  .fstat_h = handler_fstat,
  .ftruncate_h = handler_ftruncate,
  .fsync_h = handler_fsync,
  .fdatasync_h = handler_fdatasync,
  .fcntl_h = handler_fcntl,
  .readv_h = handler_readv,
  .writev_h = handler_writev
};

static IMFS_jnode_t *node_initialize(
  IMFS_jnode_t *node,
  void *arg
)
{
  test_state *state = NULL;

  node = IMFS_node_initialize_generic(node, arg);
  state = IMFS_generic_get_context_by_node(node);

  //rtems_test_assert(*state == TEST_NEW);
  *state = TEST_INITIALIZED;

  return node;
}

static IMFS_jnode_t *node_remove(IMFS_jnode_t *node)
{
  test_state *state = IMFS_generic_get_context_by_node(node);

  //rtems_test_assert(*state == TEST_FSTAT_UNLINK);
  *state = TEST_REMOVED;

  return node;
}

static void node_destroy(IMFS_jnode_t *node)
{
  test_state *state = IMFS_generic_get_context_by_node(node);

  //rtems_test_assert(*state == TEST_REMOVED);
  *state = TEST_DESTROYED;

  IMFS_node_destroy_default(node);
}

static const IMFS_node_control node_control = {
  .handlers = &node_handlers,
  .node_initialize = node_initialize,
  .node_remove = node_remove,
  .node_destroy = node_destroy
};

static void test_imfs_make_generic_node(void)
{
  test_state state = TEST_NEW;
  int rv = 0;
  int fd = 0;
  const char *path = "generic";
  char buf [1];
  ssize_t n = 0;
  off_t off = 0;
  struct iovec iov = {
    .iov_base = &buf [0],
    .iov_len = (int) sizeof(buf)
  };

  rv = IMFS_make_generic_node(
    path,
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    &state
  );
  //rtems_test_assert(rv == 0);

  fd = open(path, O_RDWR);
  //rtems_test_assert(fd >= 0);

  n = read(fd, buf, sizeof(buf));
  //rtems_test_assert(n == 0);

  n = write(fd, buf, sizeof(buf));
  //rtems_test_assert(n == 0);

  rv = ioctl(fd, 0);
  //rtems_test_assert(rv == 0);

  off = lseek(fd, off, SEEK_SET);
  //rtems_test_assert(off == 0);

  rv = ftruncate(fd, 0);
  //rtems_test_assert(rv == 0);

  rv = fsync(fd);
  //rtems_test_assert(rv == 0);

  rv = fdatasync(fd);
  //rtems_test_assert(rv == 0);

  rv = fcntl(fd, F_GETFD);
  //rtems_test_assert(rv >= 0);

  rv = readv(fd, &iov, 1);
  //rtems_test_assert(rv == 0);

  rv = writev(fd, &iov, 1);
  //rtems_test_assert(rv == 0);

  rv = close(fd);
  //rtems_test_assert(rv == 0);

  rv = unlink(path);
  //rtems_test_assert(rv == 0);

  //rtems_test_assert(state == TEST_DESTROYED);
}

static IMFS_jnode_t *node_initialize_error(
  IMFS_jnode_t *node,
  void *arg
)
{
  errno = EIO;

  return NULL;
}

static IMFS_jnode_t *node_remove_inhibited(IMFS_jnode_t *node)
{
  //rtems_test_assert(false);

  return node;
}

static void node_destroy_inhibited(IMFS_jnode_t *node)
{
  //rtems_test_assert(false);
}

static const IMFS_node_control node_initialization_error_control = {
  .handlers = &node_handlers,
  .node_initialize = node_initialize_error,
  .node_remove = node_remove_inhibited,
  .node_destroy = node_destroy_inhibited
};

static const rtems_filesystem_operations_table *imfs_ops;

static int other_clone(rtems_filesystem_location_info_t *loc)
{
  return (*imfs_ops->clonenod_h)(loc);
}

static void test_imfs_make_generic_node_errors(void)
{
  int rv = 0;
  const char *path = "generic";
  rtems_chain_control *chain = &rtems_filesystem_mount_table;
  rtems_filesystem_mount_table_entry_t *mt_entry =
    (rtems_filesystem_mount_table_entry_t *) rtems_chain_first(chain);
  rtems_filesystem_operations_table other_ops;
  void *opaque = NULL;
  rtems_resource_snapshot before;

  rtems_resource_snapshot_take(&before);

  errno = 0;
  rv = IMFS_make_generic_node(
    path,
    S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    NULL
  );
  //rtems_test_assert(rv == -1);
  //rtems_test_assert(errno == EINVAL);
  //rtems_test_assert(rtems_resource_snapshot_check(&before));

  errno = 0;
  imfs_ops = mt_entry->ops;
  other_ops = *imfs_ops;
  other_ops.clonenod_h = other_clone;
  mt_entry->ops = &other_ops;
  rv = IMFS_make_generic_node(
    path,
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    NULL
  );
  mt_entry->ops = imfs_ops;
  //rtems_test_assert(rv == -1);
  //rtems_test_assert(errno == ENOTSUP);
  //rtems_test_assert(rtems_resource_snapshot_check(&before));

  errno = 0;
  opaque = rtems_heap_greedy_allocate(NULL, 0);
  rv = IMFS_make_generic_node(
    path,
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    NULL
  );
  rtems_heap_greedy_free(opaque);
  //rtems_test_assert(rv == -1);
  //rtems_test_assert(errno == ENOMEM);
  //rtems_test_assert(rtems_resource_snapshot_check(&before));

  errno = 0;
  rv = IMFS_make_generic_node(
    path,
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_initialization_error_control,
    NULL
  );
  //rtems_test_assert(rv == -1);
  //rtems_test_assert(errno == EIO);
  //rtems_test_assert(rtems_resource_snapshot_check(&before));

  errno = 0;
  rv = IMFS_make_generic_node(
    "/nil/nada",
    S_IFCHR | S_IRWXU | S_IRWXG | S_IRWXO,
    &node_control,
    NULL
  );
  //rtems_test_assert(rv == -1);
  //rtems_test_assert(errno == ENOENT);
  //rtems_test_assert(rtems_resource_snapshot_check(&before));
}

static void
default_network_set_self_prio(rtems_task_priority prio)
{
	rtems_status_code sc;

	sc = rtems_task_set_priority(RTEMS_SELF, prio, &prio);
	assert(sc == RTEMS_SUCCESSFUL);
}

static void
default_network_ifconfig_lo0(void)
{
	int exit_code;
	char *lo0[] = {
		"ifconfig",
		"lo0",
		"inet",
		"127.0.0.1",
		"netmask",
		"255.255.255.0",
		NULL
	};
	char *lo0_inet6[] = {
		"ifconfig",
		"lo0",
		"inet6",
		"::1",
		"prefixlen",
		"128",
		"alias",
		NULL
	};

	exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0);
	assert(exit_code == EX_OK);

	exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6);
	assert(exit_code == EX_OK);
}

#ifndef DEFAULT_NETWORK_NO_INTERFACE_0
static void
default_network_ifconfig_hwif0(char *ifname)
{
	int exit_code;
	char *ifcfg[] = {
		"ifconfig",
		ifname,
#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
		"up",
#else
		"inet",
		NET_CFG_SELF_IP,
		"netmask",
		NET_CFG_NETMASK,
#endif
		NULL
	};

	exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(ifcfg), ifcfg);
	assert(exit_code == EX_OK);
}

static void
default_network_route_hwif0(char *ifname)
{
#ifndef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
	int exit_code;
	char *dflt_route[] = {
		"route",
		"add",
		"-host",
		NET_CFG_GATEWAY_IP,
		"-iface",
		ifname,
		NULL
	};
	char *dflt_route2[] = {
		"route",
		"add",
		"default",
		NET_CFG_GATEWAY_IP,
		NULL
	};

	exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route), dflt_route);
	assert(exit_code == EXIT_SUCCESS);

	exit_code = rtems_bsd_command_route(RTEMS_BSD_ARGC(dflt_route2), dflt_route2);
	assert(exit_code == EXIT_SUCCESS);
#endif
}
#endif

#ifdef DEFAULT_NETWORK_DHCPCD_ENABLE
static void
default_network_dhcpcd_task(rtems_task_argument arg)
{
	int exit_code;
	char *dhcpcd[] = {
		"dhcpcd",
		NULL
	};

#ifdef DEFAULT_NETWORK_DHCPCD_NO_DHCP_DISCOVERY
	static const char cfg[] = "nodhcp\nnodhcp6\n";
	int fd;
	int rv;
	ssize_t n;

	fd = open("/etc/dhcpcd.conf", O_CREAT | O_WRONLY,
	    S_IRWXU | S_IRWXG | S_IRWXO);
	assert(fd >= 0);

	n = write(fd, cfg, sizeof(cfg));
	assert(n == (ssize_t) sizeof(cfg));

	rv = close(fd);
	assert(rv == 0);
#endif

	exit_code = rtems_bsd_command_dhcpcd(RTEMS_BSD_ARGC(dhcpcd), dhcpcd);
	assert(exit_code == EXIT_SUCCESS);
}
#endif

static void
default_network_dhcpcd(void)
{
#ifdef DEFAULT_NETWORK_DHCPCD_ENABLE
	rtems_status_code sc;
	rtems_id id;

	sc = rtems_task_create(
		rtems_build_name('D', 'H', 'C', 'P'),
		RTEMS_MAXIMUM_PRIORITY - 1,
		RTEMS_MINIMUM_STACK_SIZE,
		RTEMS_DEFAULT_MODES,
		RTEMS_FLOATING_POINT,
		&id
	);
	assert(sc == RTEMS_SUCCESSFUL);

	sc = rtems_task_start(id, default_network_dhcpcd_task, 0);
	assert(sc == RTEMS_SUCCESSFUL);
#endif
}

static void
default_network_on_exit(int exit_code, void *arg)
{
	rtems_stack_checker_report_usage_with_plugin(NULL,
	    rtems_printf_plugin);

	if (exit_code == 0) {
		puts("*** END OF SIMULATION ***");
	}
}

/*
char *bufr = "Happy days are here again.  Happy days are here again.1Happy "
"days are here again.2Happy days are here again.3Happy days are here again."
"4Happy days are here again.5Happy days are here again.6Happy days are here "
"again.7Happy days are here again.";

int mytest(){
   int fd;
   int i, n, total;
   char *bufr2;
struct stat sb;
   printf( "BUFSIZ = %d\n", BUFSIZ );
   bufr2 = (char *)malloc(BUFSIZ);
   mkdir("/", S_IWRITE|S_IREAD);
   chdir("/");
   mkdir("conf",S_IWRITE|S_IREAD);
   if (stat("conf", &sb) == -1) {
               perror("stat");
               exit(EXIT_FAILURE);
           }
   mkdir("htd",S_IWRITE|S_IREAD);
   if (stat("htd", &sb) == -1) {
               perror("stat");
               exit(EXIT_FAILURE);
           }
   mkdir("log",S_IWRITE|S_IREAD);
   if (stat("log", &sb) == -1) {
               perror("stat");
               exit(EXIT_FAILURE);
           }

   chdir("conf");
   fd = creat("monkey.conf",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,monkey_conf,monkey_conf_size);
   close(fd);
   fd = creat("monkey.mime",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,monkey_mime,monkey_mime_size);
   close(fd);
   fd = creat("plugins.load",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,plugins_load,plugins_load_size);
   close(fd);
   mkdir("sites",S_IWRITE|S_IREAD);
   chdir("sites");
   fd = creat("default",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,default_file,default_file_size);
   close(fd);
   chdir("/");
   chdir("htd");
   mkdir("imgs",S_IWRITE|S_IREAD);
   if (stat("imgs", &sb) == -1) {
               perror("stat");
               exit(EXIT_FAILURE);
           }
   mkdir("css",S_IWRITE|S_IREAD);
   if (stat("css", &sb) == -1) {
               perror("stat");
               exit(EXIT_FAILURE);
           }
   fd = creat("404.html",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,notfound_html,notfound_html_size);
   close(fd);
   fd = creat("index.html",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,index_html,index_html_size);
   close(fd);
   fd = creat("favicon.ico",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,favicon_ico,favicon_ico_size);
   close(fd);
   chdir("imgs");
   fd = creat("info_pic.jpg",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,info_pic_jpg,info_pic_jpg_size);
   close(fd);
   fd = creat("monkey_logo.png",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,monkey_logo_png,monkey_logo_png_size);
   close(fd);
   chdir("/");
   chdir("htd");
   chdir("css");
   fd = creat("bootstrap.min.css",S_IRWXU | S_IRWXG | S_IRWXO);
   write(fd,bootstrap_min_css,bootstrap_min_css_size);
   close(fd);

}
*/

int mytest2(){
#define TARFILE_START filesystem
#define TARFILE_SIZE  filesystem_size
 printf("Untaring from memory - ");
struct stat sb;
int  sc = Untar_FromMemory((void *)TARFILE_START, TARFILE_SIZE);
  if (sc != RTEMS_SUCCESSFUL) {
    printf ("error: untar failed: %s\n", rtems_status_text (sc));
    exit(1);
  }
  printf ("successful\n");
   if (stat("monktest", &sb) == -1) {
               printf("\n\n monktest \n\n");
               perror("stat");
               exit(EXIT_FAILURE);
           }
      if (stat("monktest/conf", &sb) == -1) {
               printf("\n\n monktest/conf \n\n");
               perror("stat");
               exit(EXIT_FAILURE);
           }
         if (stat("monktest/conf/monkey.conf", &sb) == -1) {
                              printf("\n\n monktest/conf/monkey.conf \n\n");
               perror("stat");
               exit(EXIT_FAILURE);
           }

}

static void
Init(rtems_task_argument arg)
{
	rtems_status_code sc;
#ifndef DEFAULT_NETWORK_NO_INTERFACE_0
#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
	char ifnamebuf[IF_NAMESIZE];
#endif
	char *ifname;
#endif

	puts("*** MONKEY HTTP SERVER SIMULATION ***");

	on_exit(default_network_on_exit, NULL);

#ifdef DEFAULT_EARLY_INITIALIZATION
	early_initialization();
#endif

	/* Let other tasks run to complete background work */
	default_network_set_self_prio(RTEMS_MAXIMUM_PRIORITY - 1);

#ifdef DEFAULT_NETWORK_SHELL
	sc = rtems_shell_init(
		"SHLL",
		32 * 1024,
		1,
		CONSOLE_DEVICE_NAME,
		false,
		false,
		NULL
	);
	assert(sc == RTEMS_SUCCESSFUL);
#endif

	rtems_bsd_initialize();

#ifndef DEFAULT_NETWORK_NO_INTERFACE_0
#ifdef DEFAULT_NETWORK_NO_STATIC_IFCONFIG
	ifname = if_indextoname(1, &ifnamebuf[0]);
	assert(ifname != NULL);
#else
	ifname = NET_CFG_INTERFACE_0;
#endif
#endif

	/* Let the callout timer allocate its resources */
	sc = rtems_task_wake_after(2);
	assert(sc == RTEMS_SUCCESSFUL);

	default_network_ifconfig_lo0();
#ifndef DEFAULT_NETWORK_NO_INTERFACE_0
	default_network_ifconfig_hwif0(ifname);
	default_network_route_hwif0(ifname);
#endif
	default_network_dhcpcd();
  test_state state = TEST_NEW;
mytest2();

	monkey_main();

	assert(0);
}

#include <machine/rtems-bsd-sysinit.h>

SYSINIT_NEED_NET_PF_UNIX;
SYSINIT_NEED_NET_IF_LAGG;
SYSINIT_NEED_NET_IF_VLAN;

#include <bsp/nexus-devices.h>

#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_STUB_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_ZERO_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_LIBBLOCK

#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM

#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 512

#define CONFIGURE_MAXIMUM_USER_EXTENSIONS 1

#define CONFIGURE_UNLIMITED_ALLOCATION_SIZE 32
#define CONFIGURE_UNLIMITED_OBJECTS
#define CONFIGURE_UNIFIED_WORK_AREAS

#define CONFIGURE_STACK_CHECKER_ENABLED

#define CONFIGURE_FIFOS_ENABLED
#define CONFIGURE_MAXIMUM_FIFOS 8
#define CONFIGURE_MAXIMUM_PIPES 8

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE

#define CONFIGURE_INIT_TASK_STACK_SIZE (32 * 1024)
#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
#define CONFIGURE_INIT_TASK_ATTRIBUTES RTEMS_FLOATING_POINT

#define CONFIGURE_INIT

#include <rtems/confdefs.h>

#ifdef DEFAULT_NETWORK_SHELL

#define CONFIGURE_SHELL_COMMANDS_INIT

#include <bsp/irq-info.h>

#include <rtems/netcmds-config.h>

#define CONFIGURE_SHELL_USER_COMMANDS \
  &bsp_interrupt_shell_command, \
  &rtems_shell_BSD_Command, \
  &rtems_shell_HOSTNAME_Command, \
  &rtems_shell_PING_Command, \
  &rtems_shell_ROUTE_Command, \
  &rtems_shell_NETSTAT_Command, \
  &rtems_shell_IFCONFIG_Command

#define CONFIGURE_SHELL_COMMAND_CPUUSE
#define CONFIGURE_SHELL_COMMAND_PERIODUSE
#define CONFIGURE_SHELL_COMMAND_STACKUSE
#define CONFIGURE_SHELL_COMMAND_PROFREPORT

#define CONFIGURE_SHELL_COMMAND_CP
#define CONFIGURE_SHELL_COMMAND_PWD
#define CONFIGURE_SHELL_COMMAND_LS
#define CONFIGURE_SHELL_COMMAND_LN
#define CONFIGURE_SHELL_COMMAND_LSOF
#define CONFIGURE_SHELL_COMMAND_CHDIR
#define CONFIGURE_SHELL_COMMAND_CD
#define CONFIGURE_SHELL_COMMAND_MKDIR
#define CONFIGURE_SHELL_COMMAND_RMDIR
#define CONFIGURE_SHELL_COMMAND_CAT
#define CONFIGURE_SHELL_COMMAND_MV
#define CONFIGURE_SHELL_COMMAND_RM
#define CONFIGURE_SHELL_COMMAND_MALLOC_INFO

#include <rtems/shellconfig.h>

#endif /* DEFAULT_NETWORK_SHELL */


text:
<!DOCTYPE html>

<meta charset="UTF-8">
<title>accesskey attribute</title>

this link has an accesskey attribute with an invalid surrogate pair (a high surrogate followed by a 'b')

redpajama_set_name: RedPajamaGithub


text:
# Culqi Python

[![Build Status](https://travis-ci.org/culqi/culqi-python.svg?branch=master)](https://travis-ci.org/culqi/culqi-python)
![](https://img.shields.io/pypi/pyversions/Culqi)
![](https://img.shields.io/pypi/l/culqi)
![](https://img.shields.io/pypi/v/culqi)

Biblioteca de CULQI para el lenguaje Python, pagos simples en tu sitio web.

## Requisitos

- Python 2.7, 3.5, 3.6, 3.7, 3.8-dev
- Credenciales de comercio en [Culqi](https://culqi.com).

## Instalación

```bash
pip install culqi
```

![](/resources/carbon.png)

Cada metodo retona un diccionario con la estructura

```python
{
      "status": status_code,
      "data": data
}
```

El `status_code` es el estatus HTTP numérico devuelto por la solicitud HTTP que se
realiza al API de Culqi, y `data` contiene el cuerpo de la respuesta obtenida.

## Documentación

- [Referencia de API](https://www.culqi.com/api/)
- [Ejemplos](https://github.com/culqi/culqi-python/wiki)
- [Wiki](https://github.com/culqi/culqi-python/wiki)

## Changelog

Todos los cambios en las versiones de esta biblioteca están listados en
[CHANGELOG.md](CHANGELOG.md).

## Desarrollo
[Revisa nuestra guia de contribución](CONTRIBUTING.md)

## Contribuidores


text:
var request = require('request');
var Q = require('q');
var url = require('url');
var object = require('mout/object');
var createError = require('./createError');

function requestWrapper(requestUrl, config) {
    var deferred = Q.defer();

    var protocol = url.parse(requestUrl).protocol;

    var _request = request.defaults({
        ca: config.ca.search[0],
        strictSSL: config.strictSsl,
        timeout: config.timeout
    })

    _request = _request.defaults(config.request || {})

    _request(requestUrl, function (error, response, body) {
        if (error) {
            deferred.reject(createError('Request to ' + requestUrl + ' failed: ' + error.message, error.code));
        } else {
            if (response.statusCode === 200) {
                deferred.resolve(body);
            } else {
                deferred.reject(createError('Request to ' + requestUrl + ' returned ' + response.statusCode + ' status code.', 'EREQUEST', {
                    details: response.toString()
                }));
            }
        }
    });

    return deferred.promise;
};

module.exports = requestWrapper;


text:
"""General IMPROVER metadata utilities"""

import hashlib
import pprint
from typing import Any, Dict, List, Optional, Type, Union

import dask.array as da
import iris
import numpy as np
from cf_units import Unit
from iris.cube import Cube
from numpy import ndarray
from numpy.ma.core import MaskedArray

from improver.metadata.constants.attributes import (
    MANDATORY_ATTRIBUTE_DEFAULTS,
    MANDATORY_ATTRIBUTES,
)

def create_new_diagnostic_cube(
    name: str,
    units: Union[Unit, str],
    template_cube: Cube,
    mandatory_attributes: Union[Dict[str, str], Dict],
    optional_attributes: Optional[Union[Dict[str, str], Dict]] = None,
    data: Optional[Union[MaskedArray, ndarray]] = None,
    dtype: Type = np.float32,
) -> Cube:
    """
    Creates a new diagnostic cube with suitable metadata.

    Args:
        name:
            Standard or long name for output cube
        units:
            Units for output cube
        template_cube:
            Cube from which to copy dimensional and auxiliary coordinates
        mandatory_attributes:
            Dictionary containing values for the mandatory attributes
            "title", "source" and "institution".  These are overridden by
            values in the optional_attributes dictionary, if specified.
        optional_attributes:
            Dictionary of optional attribute names and values.  If values for
            mandatory attributes are included in this dictionary they override
            the values of mandatory_attributes.
        data:
            Data array.  If not set, cube is filled with zeros using a lazy
            data object, as this will be overwritten later by the caller
            routine.
        dtype:
            Datatype for dummy cube data if "data" argument is None.

    Returns:
        Cube with correct metadata to accommodate new diagnostic field
    """
    attributes = mandatory_attributes
    if optional_attributes is not None:
        attributes.update(optional_attributes)

    error_msg = ""
    for attr in MANDATORY_ATTRIBUTES:
        if attr not in attributes:
            error_msg += "{} attribute is required\n".format(attr)
    if error_msg:
        raise ValueError(error_msg)

    if data is None:
        data = da.zeros_like(template_cube.core_data(), dtype=dtype)

    aux_coords_and_dims, dim_coords_and_dims = [
        [
            (coord.copy(), template_cube.coord_dims(coord))
            for coord in getattr(template_cube, coord_type)
        ]
        for coord_type in ("aux_coords", "dim_coords")
    ]

    cube = iris.cube.Cube(
        data,
        units=units,
        attributes=attributes,
        dim_coords_and_dims=dim_coords_and_dims,
        aux_coords_and_dims=aux_coords_and_dims,
    )
    cube.rename(name)

    return cube

def generate_mandatory_attributes(
    diagnostic_cubes: List[Cube], model_id_attr: Optional[str] = None
) -> Dict[str, str]:
    """
    Function to generate mandatory attributes for new diagnostics that are
    generated using several different model diagnostics as input to the
    calculation.  If all input diagnostics have the same attribute use this,
    otherwise set a default value.

    Args:
        diagnostic_cubes:
            List of diagnostic cubes used in calculating the new diagnostic
        model_id_attr:
            Name of attribute used to identify source model for blending,
            if required

    Returns:
        Dictionary of mandatory attribute "key": "value" pairs.
    """
    missing_value = object()
    attr_dicts = [cube.attributes for cube in diagnostic_cubes]
    required_attributes = [model_id_attr] if model_id_attr else []
    attributes = MANDATORY_ATTRIBUTE_DEFAULTS.copy()
    for attr in MANDATORY_ATTRIBUTES + required_attributes:
        unique_values = {d.get(attr, missing_value) for d in attr_dicts}
        if len(unique_values) == 1 and missing_value not in unique_values:
            (attributes[attr],) = unique_values
        elif attr in required_attributes:
            msg = (
                'Required attribute "{}" is missing or '
                "not the same on all input cubes"
            )
            raise ValueError(msg.format(attr))
    return attributes

def generate_hash(data_in: Any) -> str:
    """
    Generate a hash from the data_in that can be used to uniquely identify
    equivalent data_in.

    Args:
        data_in:
            The data from which a hash is to be generated. This can be of any
            type that can be pretty printed.

    Returns:
        A hexadecimal string which is a hash hexdigest of the data as a
        string.
    """
    bytestring = pprint.pformat(data_in).encode("utf-8")
    return hashlib.sha256(bytestring).hexdigest()

def create_coordinate_hash(cube: Cube) -> str:
    """
    Generate a hash based on the input cube's x and y coordinates. This
    acts as a unique identifier for the grid which can be used to allow two
    grids to be compared.

    Args:
        cube:
            The cube from which x and y coordinates will be used to
            generate a hash.

    Returns:
        A hash created using the x and y coordinates of the input cube.
    """
    hashable_data = []
    for axis in ("x", "y"):
        coord = cube.coord(axis=axis)
        hashable_data.extend(
            [
                list(coord.points),
                list(coord.bounds) if isinstance(coord.bounds, list) else None,
                coord.standard_name,
                coord.long_name,
                coord.coord_system,
                coord.units,
            ]
        )
    return generate_hash(hashable_data)

def get_model_id_attr(cubes: List[Cube], model_id_attr: str) -> str:
    """
    Gets the specified model ID attribute from a list of input cubes, checking
    that the value is the same on all those cubes in the process.

    Args:
        cubes:
            List of cubes to get the attribute from
        model_id_attr:
            Attribute name

    Returns:
        The unique attribute value

    """
    try:
        model_id_value = {cube.attributes[model_id_attr] for cube in cubes}
    except KeyError as error:
        failing_cubes = [
            cube.name()
            for cube in cubes
            if not cube.attributes.get(model_id_attr, False)
        ]
        raise ValueError(
            f"Model ID attribute {model_id_attr} not present for {', '.join(failing_cubes)}."
        ) from error
    if len(model_id_value) != 1:
        raise ValueError(
            f"Attribute {model_id_attr} must be the same for all input cubes. "
            f"{' != '.join(model_id_value)}"
        )
    (model_id_value,) = model_id_value
    return model_id_value


text:
using namespace glbinding;

namespace gl
{

void glFeedbackBuffer(GLsizei size, GLenum type, GLfloat * buffer)
{
    return Binding::FeedbackBuffer(size, type, buffer);
}

void glFeedbackBufferxOES(GLsizei n, GLenum type, const GLfixed * buffer)
{
    return Binding::FeedbackBufferxOES(n, type, buffer);
}

GLsync glFenceSync(GLenum condition, UnusedMask flags)
{
    return Binding::FenceSync(condition, flags);
}

void glFinalCombinerInputNV(GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage)
{
    return Binding::FinalCombinerInputNV(variable, input, mapping, componentUsage);
}

void glFinish()
{
    return Binding::Finish();
}

GLint glFinishAsyncSGIX(GLuint * markerp)
{
    return Binding::FinishAsyncSGIX(markerp);
}

void glFinishFenceAPPLE(GLuint fence)
{
    return Binding::FinishFenceAPPLE(fence);
}

void glFinishFenceNV(GLuint fence)
{
    return Binding::FinishFenceNV(fence);
}

void glFinishObjectAPPLE(GLenum object, GLint name)
{
    return Binding::FinishObjectAPPLE(object, name);
}

void glFinishTextureSUNX()
{
    return Binding::FinishTextureSUNX();
}

void glFlush()
{
    return Binding::Flush();
}

void glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
{
    return Binding::FlushMappedBufferRange(target, offset, length);
}

void glFlushMappedBufferRangeAPPLE(GLenum target, GLintptr offset, GLsizeiptr size)
{
    return Binding::FlushMappedBufferRangeAPPLE(target, offset, size);
}

void glFlushMappedNamedBufferRange(GLuint buffer, GLintptr offset, GLsizeiptr length)
{
    return Binding::FlushMappedNamedBufferRange(buffer, offset, length);
}

void glFlushMappedNamedBufferRangeEXT(GLuint buffer, GLintptr offset, GLsizeiptr length)
{
    return Binding::FlushMappedNamedBufferRangeEXT(buffer, offset, length);
}

void glFlushPixelDataRangeNV(GLenum target)
{
    return Binding::FlushPixelDataRangeNV(target);
}

void glFlushRasterSGIX()
{
    return Binding::FlushRasterSGIX();
}

void glFlushStaticDataIBM(GLenum target)
{
    return Binding::FlushStaticDataIBM(target);
}

void glFlushVertexArrayRangeAPPLE(GLsizei length, void * pointer)
{
    return Binding::FlushVertexArrayRangeAPPLE(length, pointer);
}

void glFlushVertexArrayRangeNV()
{
    return Binding::FlushVertexArrayRangeNV();
}

void glFogCoordFormatNV(GLenum type, GLsizei stride)
{
    return Binding::FogCoordFormatNV(type, stride);
}

void glFogCoordPointer(GLenum type, GLsizei stride, const void * pointer)
{
    return Binding::FogCoordPointer(type, stride, pointer);
}

void glFogCoordPointerEXT(GLenum type, GLsizei stride, const void * pointer)
{
    return Binding::FogCoordPointerEXT(type, stride, pointer);
}

void glFogCoordPointerListIBM(GLenum type, GLint stride, const void ** pointer, GLint ptrstride)
{
    return Binding::FogCoordPointerListIBM(type, stride, pointer, ptrstride);
}

void glFogCoordd(GLdouble coord)
{
    return Binding::FogCoordd(coord);
}

void glFogCoorddEXT(GLdouble coord)
{
    return Binding::FogCoorddEXT(coord);
}

void glFogCoorddv(const GLdouble * coord)
{
    return Binding::FogCoorddv(coord);
}

void glFogCoorddvEXT(const GLdouble * coord)
{
    return Binding::FogCoorddvEXT(coord);
}

void glFogCoordf(GLfloat coord)
{
    return Binding::FogCoordf(coord);
}

void glFogCoordfEXT(GLfloat coord)
{
    return Binding::FogCoordfEXT(coord);
}

void glFogCoordfv(const GLfloat * coord)
{
    return Binding::FogCoordfv(coord);
}

void glFogCoordfvEXT(const GLfloat * coord)
{
    return Binding::FogCoordfvEXT(coord);
}

void glFogCoordhNV(GLhalfNV fog)
{
    return Binding::FogCoordhNV(fog);
}

void glFogCoordhvNV(const GLhalfNV * fog)
{
    return Binding::FogCoordhvNV(fog);
}

void glFogFuncSGIS(GLsizei n, const GLfloat * points)
{
    return Binding::FogFuncSGIS(n, points);
}

void glFogf(GLenum pname, GLfloat param)
{
    return Binding::Fogf(pname, param);
}

void glFogfv(GLenum pname, const GLfloat * params)
{
    return Binding::Fogfv(pname, params);
}

void glFogi(GLenum pname, GLint param)
{
    return Binding::Fogi(pname, param);
}

void glFogiv(GLenum pname, const GLint * params)
{
    return Binding::Fogiv(pname, params);
}

void glFogxOES(GLenum pname, GLfixed param)
{
    return Binding::FogxOES(pname, param);
}

void glFogxvOES(GLenum pname, const GLfixed * param)
{
    return Binding::FogxvOES(pname, param);
}

void glFragmentColorMaterialSGIX(GLenum face, GLenum mode)
{
    return Binding::FragmentColorMaterialSGIX(face, mode);
}

void glFragmentCoverageColorNV(GLuint color)
{
    return Binding::FragmentCoverageColorNV(color);
}

void glFragmentLightModelfSGIX(GLenum pname, GLfloat param)
{
    return Binding::FragmentLightModelfSGIX(pname, param);
}

void glFragmentLightModelfvSGIX(GLenum pname, const GLfloat * params)
{
    return Binding::FragmentLightModelfvSGIX(pname, params);
}

void glFragmentLightModeliSGIX(GLenum pname, GLint param)
{
    return Binding::FragmentLightModeliSGIX(pname, param);
}

void glFragmentLightModelivSGIX(GLenum pname, const GLint * params)
{
    return Binding::FragmentLightModelivSGIX(pname, params);
}

void glFragmentLightfSGIX(GLenum light, GLenum pname, GLfloat param)
{
    return Binding::FragmentLightfSGIX(light, pname, param);
}

void glFragmentLightfvSGIX(GLenum light, GLenum pname, const GLfloat * params)
{
    return Binding::FragmentLightfvSGIX(light, pname, params);
}

void glFragmentLightiSGIX(GLenum light, GLenum pname, GLint param)
{
    return Binding::FragmentLightiSGIX(light, pname, param);
}

void glFragmentLightivSGIX(GLenum light, GLenum pname, const GLint * params)
{
    return Binding::FragmentLightivSGIX(light, pname, params);
}

void glFragmentMaterialfSGIX(GLenum face, GLenum pname, GLfloat param)
{
    return Binding::FragmentMaterialfSGIX(face, pname, param);
}

void glFragmentMaterialfvSGIX(GLenum face, GLenum pname, const GLfloat * params)
{
    return Binding::FragmentMaterialfvSGIX(face, pname, params);
}

void glFragmentMaterialiSGIX(GLenum face, GLenum pname, GLint param)
{
    return Binding::FragmentMaterialiSGIX(face, pname, param);
}

void glFragmentMaterialivSGIX(GLenum face, GLenum pname, const GLint * params)
{
    return Binding::FragmentMaterialivSGIX(face, pname, params);
}

void glFrameTerminatorGREMEDY()
{
    return Binding::FrameTerminatorGREMEDY();
}

void glFrameZoomSGIX(GLint factor)
{
    return Binding::FrameZoomSGIX(factor);
}

void glFramebufferDrawBufferEXT(GLuint framebuffer, GLenum mode)
{
    return Binding::FramebufferDrawBufferEXT(framebuffer, mode);
}

void glFramebufferDrawBuffersEXT(GLuint framebuffer, GLsizei n, const GLenum * bufs)
{
    return Binding::FramebufferDrawBuffersEXT(framebuffer, n, bufs);
}

void glFramebufferParameteri(GLenum target, GLenum pname, GLint param)
{
    return Binding::FramebufferParameteri(target, pname, param);
}

void glFramebufferReadBufferEXT(GLuint framebuffer, GLenum mode)
{
    return Binding::FramebufferReadBufferEXT(framebuffer, mode);
}

void glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
    return Binding::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
}

void glFramebufferRenderbufferEXT(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
{
    return Binding::FramebufferRenderbufferEXT(target, attachment, renderbuffertarget, renderbuffer);
}

void glFramebufferSampleLocationsfvARB(GLenum target, GLuint start, GLsizei count, const GLfloat * v)
{
    return Binding::FramebufferSampleLocationsfvARB(target, start, count, v);
}

void glFramebufferSampleLocationsfvNV(GLenum target, GLuint start, GLsizei count, const GLfloat * v)
{
    return Binding::FramebufferSampleLocationsfvNV(target, start, count, v);
}

void glFramebufferTexture(GLenum target, GLenum attachment, GLuint texture, GLint level)
{
    return Binding::FramebufferTexture(target, attachment, texture, level);
}

void glFramebufferTexture1D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    return Binding::FramebufferTexture1D(target, attachment, textarget, texture, level);
}

void glFramebufferTexture1DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    return Binding::FramebufferTexture1DEXT(target, attachment, textarget, texture, level);
}

void glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    return Binding::FramebufferTexture2D(target, attachment, textarget, texture, level);
}

void glFramebufferTexture2DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
{
    return Binding::FramebufferTexture2DEXT(target, attachment, textarget, texture, level);
}

void glFramebufferTexture3D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
{
    return Binding::FramebufferTexture3D(target, attachment, textarget, texture, level, zoffset);
}

void glFramebufferTexture3DEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
{
    return Binding::FramebufferTexture3DEXT(target, attachment, textarget, texture, level, zoffset);
}

void glFramebufferTextureARB(GLenum target, GLenum attachment, GLuint texture, GLint level)
{
    return Binding::FramebufferTextureARB(target, attachment, texture, level);
}

void glFramebufferTextureEXT(GLenum target, GLenum attachment, GLuint texture, GLint level)
{
    return Binding::FramebufferTextureEXT(target, attachment, texture, level);
}

void glFramebufferTextureFaceARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face)
{
    return Binding::FramebufferTextureFaceARB(target, attachment, texture, level, face);
}

void glFramebufferTextureFaceEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face)
{
    return Binding::FramebufferTextureFaceEXT(target, attachment, texture, level, face);
}

void glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
    return Binding::FramebufferTextureLayer(target, attachment, texture, level, layer);
}

void glFramebufferTextureLayerARB(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
    return Binding::FramebufferTextureLayerARB(target, attachment, texture, level, layer);
}

void glFramebufferTextureLayerEXT(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
{
    return Binding::FramebufferTextureLayerEXT(target, attachment, texture, level, layer);
}

void glFramebufferTextureMultiviewOVR(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews)
{
    return Binding::FramebufferTextureMultiviewOVR(target, attachment, texture, level, baseViewIndex, numViews);
}

void glFreeObjectBufferATI(GLuint buffer)
{
    return Binding::FreeObjectBufferATI(buffer);
}

void glFrontFace(GLenum mode)
{
    return Binding::FrontFace(mode);
}

void glFrustum(GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)
{
    return Binding::Frustum(left, right, bottom, top, zNear, zFar);
}

void glFrustumfOES(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f)
{
    return Binding::FrustumfOES(l, r, b, t, n, f);
}

void glFrustumxOES(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f)
{
    return Binding::FrustumxOES(l, r, b, t, n, f);
}

} // namespace gl


text:
#include "eol-typecache.h"
#include "eol-util.h"
#include "uthash.h"

typedef struct _EolTypeCacheEntry EolTypeCacheEntry;

struct _EolTypeCacheEntry {
    uint32_t           offset;
    const EolTypeInfo *typeinfo;
    UT_hash_handle     hh;
};

void
eol_type_cache_init (EolTypeCache *cache)
{
    CHECK_NOT_NULL (cache);
    *cache = NULL;
}

void
eol_type_cache_free (EolTypeCache *cache)
{
    CHECK_NOT_NULL (cache);

    EolTypeCacheEntry *entry, *tmp;
    HASH_ITER (hh, *cache, entry, tmp) {
        /* XXX: This leaks the EolTypeInfo. */
        HASH_DEL (*cache, entry);
        free (entry);
    }
}

const EolTypeInfo*
eol_type_cache_lookup (EolTypeCache *cache,
                       uint32_t      offset)
{
    CHECK_NOT_NULL (cache);

    EolTypeCacheEntry *entry;
    HASH_FIND_INT (*cache, &offset, entry);
    return entry ? entry->typeinfo : NULL;
}

void
eol_type_cache_add (EolTypeCache      *cache,
                    uint32_t           offset,
                    const EolTypeInfo *typeinfo)
{
    CHECK_NOT_NULL (cache);
    CHECK_NOT_NULL (typeinfo);

    EolTypeCacheEntry *entry = malloc (sizeof (EolTypeCacheEntry));
    entry->offset   = offset;
    entry->typeinfo = typeinfo;

    HASH_ADD_INT (*cache, offset, entry);
}

void
eol_type_cache_foreach (EolTypeCache    *cache,
                        EolTypeCacheIter callback,
                        void            *userdata)
{
    CHECK_NOT_NULL (cache);
    CHECK_NOT_NULL (callback);

    EolTypeCacheEntry *entry, *tmp;
    HASH_ITER (hh, *cache, entry, tmp) {
        if (!(*callback) (cache, entry->typeinfo, userdata))
            break;
    }
}


text:
'use strict';

/**
* Get all workflow runs for a repository.
*
* @module @stdlib/_tools/github/workflow-runs
*
* @example
* var workflowRuns = require( '@stdlib/_tools/github/workflow-runs' );
*
* var opts = {
*     'slug': 'stdlib-js/utils-noop'
* };
*
* workflowRuns( opts, clbk );
*
* function clbk( error, results, info ) {
*     // Check for rate limit information...
*     if ( info ) {
*         console.error( 'Limit: %d', info.limit );
*         console.error( 'Remaining: %d', info.remaining );
*         console.error( 'Reset: %s', (new Date( info.reset*1000 )).toISOString() );
*     }
*     if ( error ) {
*         throw new Error( error.message );
*     }
*     console.log( JSON.stringify( results ) );
*     // => <repo_data>
* }
*/

// MODULES //

var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
var main = require( './main.js' );
var factory = require( './factory.js' );

// MAIN //

setReadOnly( main, 'factory', factory );

// EXPORTS //

module.exports = main;


text:
'use strict';

// Configuring the Articles module
angular.module('articles').run(['Menus',
  function (Menus) {
    // Add the articles dropdown item

  }
]);


text:
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0"
    jcr:primaryType="cq:ClientLibraryFolder"
    categories="[apps.brucelefebvre.kitchen-sink.all]"
    dependencies="[kitchen-sink.ionic-1.1.0]"
    embed="[btford-angular-phonegap,apps.brucelefebvre.kitchen-sink.phonegap.util,apps.brucelefebvre.nav,apps.brucelefebvre.kitchen-sink.phonegap.api,apps.brucelefebvre.kitchen-sink,cq.mobile.content-sync-2]"/>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Euryachora sacchari Av.-Saccá

### Remarks
null


text:
var Path = require('path');

var Hapi = require('hapi');

var server = new Hapi.Server({});

server.connection({port: 8000});

var options = {
	goodOptions: {
		opsInterval: 1000,
		reporters: [{
			reporter: require('good-console'),
			events: {log: '*', response: '*'}
		}]
	}
};

server.views({
	engines: {
		html: require('handlebars')
	},
	path: Path.join(__dirname, '../public')
});

server.register({
	register: require('good'),
	options: options.goodOptions
}, function (err) {
	if (err) {
		console.error(err);
	}
});

server.start(function () {
	console.log('Server running at:', server.info.uri);
});


text:
module Rakuten
  module Review
    class Review
      def initialize(html)
        @html = html
        @div = html
      end

      def inspect
        "<Review: id=#{id}>"
      end

      def url
        @url ||= @html.css('a[contains("このレビューのURL")]').first["href"]
      end

      def user_id
        regex = /[A-Z0-9]+/
        @user_id ||= @div.css('a[href^="/gp/pdp/profile"]').first["href"][regex]
      end

      def title
        @title ||= @html.css('.revRvwUserEntryTtl.summary').first.text
      end

      def date
        @date ||= Date.parse(@html.css('.revUserEntryDate.dtreviewed').first.text)
      end

      def text
        # remove leading and trailing line returns, tabs, and spaces
        @text ||= @html.css('.revRvwUserEntryCmt.description').first.text
      end

      def rating
        @rating ||= Float(@html.css('.revUserRvwerNum.value').first.text)
      end

      def helpful_count
        @helpful_count ||= Int(@html.css('.revEntryAnsNum').first.text)
      end

      def to_hash
        attrs = [:url, :user_id, :title, :date, :text, :rating, :helpful_count]
        attrs.inject({}) do |r, attr|
          r[attr] = self.send(attr)
          r
        end
      end

    end
  end
end


text:
namespace postProcessedLexerParser.expressionModel
{
    public sealed class Variable : Expression
    {
        private readonly string VariableName;

        public Variable(string varName)
        {
            VariableName = varName;
        }

        public double? Evaluate(ExpressionContext context)
        {
            return context.GetValue(VariableName);
        }
    }
}


text:
/* -*- Mode: C; c-basic-offset:4 ; -*- */
/*
 *  (C) 2001 by Argonne National Laboratory.
 *      See COPYRIGHT in top-level directory.
 *
 * This file is automatically generated by buildiface
 * DO NOT EDIT
 */
#include "mpi_fortimpl.h"

/* Begin MPI profiling block */
#if defined(USE_WEAK_SYMBOLS) && !defined(USE_ONLY_MPI_NAMES)
#if defined(HAVE_MULTIPLE_PRAGMA_WEAK)
extern FORT_DLL_SPEC void FORT_CALL MPI_REGISTER_DATAREP( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep__( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep_( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#if defined(F77_NAME_UPPER)
#pragma weak MPI_REGISTER_DATAREP = PMPI_REGISTER_DATAREP
#pragma weak mpi_register_datarep__ = PMPI_REGISTER_DATAREP
#pragma weak mpi_register_datarep_ = PMPI_REGISTER_DATAREP
#pragma weak mpi_register_datarep = PMPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#pragma weak MPI_REGISTER_DATAREP = pmpi_register_datarep__
#pragma weak mpi_register_datarep__ = pmpi_register_datarep__
#pragma weak mpi_register_datarep_ = pmpi_register_datarep__
#pragma weak mpi_register_datarep = pmpi_register_datarep__
#elif defined(F77_NAME_LOWER_USCORE)
#pragma weak MPI_REGISTER_DATAREP = pmpi_register_datarep_
#pragma weak mpi_register_datarep__ = pmpi_register_datarep_
#pragma weak mpi_register_datarep_ = pmpi_register_datarep_
#pragma weak mpi_register_datarep = pmpi_register_datarep_
#else
#pragma weak MPI_REGISTER_DATAREP = pmpi_register_datarep
#pragma weak mpi_register_datarep__ = pmpi_register_datarep
#pragma weak mpi_register_datarep_ = pmpi_register_datarep
#pragma weak mpi_register_datarep = pmpi_register_datarep
#endif

#elif defined(HAVE_PRAGMA_WEAK)

#if defined(F77_NAME_UPPER)
extern FORT_DLL_SPEC void FORT_CALL MPI_REGISTER_DATAREP( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#pragma weak MPI_REGISTER_DATAREP = PMPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep__( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#pragma weak mpi_register_datarep__ = pmpi_register_datarep__
#elif !defined(F77_NAME_LOWER_USCORE)
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#pragma weak mpi_register_datarep = pmpi_register_datarep
#else
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep_( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#pragma weak mpi_register_datarep_ = pmpi_register_datarep_
#endif

#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
#if defined(F77_NAME_UPPER)
#pragma _HP_SECONDARY_DEF PMPI_REGISTER_DATAREP  MPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#pragma _HP_SECONDARY_DEF pmpi_register_datarep__  mpi_register_datarep__
#elif !defined(F77_NAME_LOWER_USCORE)
#pragma _HP_SECONDARY_DEF pmpi_register_datarep  mpi_register_datarep
#else
#pragma _HP_SECONDARY_DEF pmpi_register_datarep_  mpi_register_datarep_
#endif

#elif defined(HAVE_PRAGMA_CRI_DUP)
#if defined(F77_NAME_UPPER)
#pragma _CRI duplicate MPI_REGISTER_DATAREP as PMPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#pragma _CRI duplicate mpi_register_datarep__ as pmpi_register_datarep__
#elif !defined(F77_NAME_LOWER_USCORE)
#pragma _CRI duplicate mpi_register_datarep as pmpi_register_datarep
#else
#pragma _CRI duplicate mpi_register_datarep_ as pmpi_register_datarep_
#endif
#endif /* HAVE_PRAGMA_WEAK */
#endif /* USE_WEAK_SYMBOLS */
/* End MPI profiling block */

/* These definitions are used only for generating the Fortran wrappers */
#if defined(USE_WEAK_SYMBOLS) && defined(HAVE_MULTIPLE_PRAGMA_WEAK) && \
    defined(USE_ONLY_MPI_NAMES)
extern FORT_DLL_SPEC void FORT_CALL MPI_REGISTER_DATAREP( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep__( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
extern FORT_DLL_SPEC void FORT_CALL mpi_register_datarep_( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#if defined(F77_NAME_UPPER)
#pragma weak mpi_register_datarep__ = MPI_REGISTER_DATAREP
#pragma weak mpi_register_datarep_ = MPI_REGISTER_DATAREP
#pragma weak mpi_register_datarep = MPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#pragma weak MPI_REGISTER_DATAREP = mpi_register_datarep__
#pragma weak mpi_register_datarep_ = mpi_register_datarep__
#pragma weak mpi_register_datarep = mpi_register_datarep__
#elif defined(F77_NAME_LOWER_USCORE)
#pragma weak MPI_REGISTER_DATAREP = mpi_register_datarep_
#pragma weak mpi_register_datarep__ = mpi_register_datarep_
#pragma weak mpi_register_datarep = mpi_register_datarep_
#else
#pragma weak MPI_REGISTER_DATAREP = mpi_register_datarep
#pragma weak mpi_register_datarep__ = mpi_register_datarep
#pragma weak mpi_register_datarep_ = mpi_register_datarep
#endif

#endif

/* Map the name to the correct form */
#ifndef MPICH_MPI_FROM_PMPI
#if defined(USE_WEAK_SYMBOLS) && defined(HAVE_MULTIPLE_PRAGMA_WEAK)
/* Define the weak versions of the PMPI routine*/
#ifndef F77_NAME_UPPER
extern FORT_DLL_SPEC void FORT_CALL PMPI_REGISTER_DATAREP( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
#endif
#ifndef F77_NAME_LOWER_2USCORE
extern FORT_DLL_SPEC void FORT_CALL pmpi_register_datarep__( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
#endif
#ifndef F77_NAME_LOWER_USCORE
extern FORT_DLL_SPEC void FORT_CALL pmpi_register_datarep_( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );
#endif
#ifndef F77_NAME_LOWER
extern FORT_DLL_SPEC void FORT_CALL pmpi_register_datarep( char * FORT_MIXED_LEN_DECL, MPI_Datarep_conversion_function*, MPI_Datarep_conversion_function*, MPI_Datarep_extent_function*, void*, MPI_Fint * FORT_END_LEN_DECL );

#endif

#if defined(F77_NAME_UPPER)
#pragma weak pmpi_register_datarep__ = PMPI_REGISTER_DATAREP
#pragma weak pmpi_register_datarep_ = PMPI_REGISTER_DATAREP
#pragma weak pmpi_register_datarep = PMPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#pragma weak PMPI_REGISTER_DATAREP = pmpi_register_datarep__
#pragma weak pmpi_register_datarep_ = pmpi_register_datarep__
#pragma weak pmpi_register_datarep = pmpi_register_datarep__
#elif defined(F77_NAME_LOWER_USCORE)
#pragma weak PMPI_REGISTER_DATAREP = pmpi_register_datarep_
#pragma weak pmpi_register_datarep__ = pmpi_register_datarep_
#pragma weak pmpi_register_datarep = pmpi_register_datarep_
#else
#pragma weak PMPI_REGISTER_DATAREP = pmpi_register_datarep
#pragma weak pmpi_register_datarep__ = pmpi_register_datarep
#pragma weak pmpi_register_datarep_ = pmpi_register_datarep
#endif /* Test on name mapping */
#endif /* Use multiple pragma weak */

#ifdef F77_NAME_UPPER
#define mpi_register_datarep_ PMPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#define mpi_register_datarep_ pmpi_register_datarep__
#elif !defined(F77_NAME_LOWER_USCORE)
#define mpi_register_datarep_ pmpi_register_datarep
#else
#define mpi_register_datarep_ pmpi_register_datarep_
#endif /* Test on name mapping */

/* This defines the routine that we call, which must be the PMPI version
   since we're renaming the Fortran entry as the pmpi version.  The MPI name
   must be undefined first to prevent any conflicts with previous renamings,
   such as those put in place by the globus device when it is building on
   top of a vendor MPI. */
#undef MPI_Register_datarep
#define MPI_Register_datarep PMPI_Register_datarep

#else

#ifdef F77_NAME_UPPER
#define mpi_register_datarep_ MPI_REGISTER_DATAREP
#elif defined(F77_NAME_LOWER_2USCORE)
#define mpi_register_datarep_ mpi_register_datarep__
#elif !defined(F77_NAME_LOWER_USCORE)
#define mpi_register_datarep_ mpi_register_datarep
/* Else leave name alone */
#endif

#endif /* MPICH_MPI_FROM_PMPI */

/* Prototypes for the Fortran interfaces */
#include "fproto.h"

    /* There is a dummy routine, mpi_conversion_fn_null, that is available
       for use as the conversion function for MPI_Register_datarep.
       Like the attribute null functions, we provide multiple weak versions
       of this if possible */
#if defined(USE_WEAK_SYMBOLS) && defined(HAVE_MULTIPLE_PRAGMA_WEAK)
extern FORT_DLL_SPEC int FORT_CALL mpi_conversion_fn_null_ ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr );
extern FORT_DLL_SPEC int FORT_CALL mpi_conversion_fn_null__ ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr );
extern FORT_DLL_SPEC int FORT_CALL mpi_conversion_fn_null ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr );
extern FORT_DLL_SPEC int FORT_CALL MPI_CONVERSION_FN_NULL ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr );
/* */
#ifndef MPICH_MPI_FROM_PMPI
#pragma weak mpi_conversion_fn_null__ = mpi_conversion_fn_null_
#pragma weak mpi_conversion_fn_null   = mpi_conversion_fn_null_
#pragma weak MPI_CONVERSION_FN_NULL   = mpi_conversion_fn_null_
#endif /* MPICH_MPI_FROM_PMPI */

#else
   /* No weak symbols, so simply rename the one version to match the
      Fortran naming convention */
#ifdef F77_NAME_UPPER
#define mpi_conversion_fn_null_ MPI_CONVERSION_FN_NULL
#elif defined(F77_NAME_LOWER_2USCORE)
#define mpi_conversion_fn_null_ mpi_conversion_fn_null__
#elif !defined(F77_NAME_LOWER_USCORE)
#define mpi_conversion_fn_null_ mpi_conversion_fn_null
/* Else leave name alone */
#endif /* Test on name mapping */

/* Add the prototype so the routine knows what this is */
extern FORT_DLL_SPEC int FORT_CALL mpi_conversion_fn_null_ ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr );

#endif /* Test on use multiple weak symbols */
#ifndef MPICH_MPI_FROM_PMPI

/* This isn't a callable function */
FORT_DLL_SPEC int FORT_CALL mpi_conversion_fn_null_ ( void*v1, MPI_Fint*v2, MPI_Fint*v3, void*v4, MPI_Offset*v5, MPI_Fint *v6, MPI_Fint*v7, MPI_Fint *ierr ) {
    return 0;
}
#endif

FORT_DLL_SPEC void FORT_CALL mpi_register_datarep_ ( char *v1 FORT_MIXED_LEN(d1), MPI_Datarep_conversion_function*v2, MPI_Datarep_conversion_function*v3, MPI_Datarep_extent_function*v4, void*v5, MPI_Fint *ierr FORT_END_LEN(d1) ){
#ifdef MPI_MODE_RDONLY
    char *p1;

    {char *p = v1 + d1 - 1;
     int  li;
        while (*p == ' ' && p > v1) p--;
        p++;
        p1 = (char *)MPIU_Malloc( p-v1 + 1 );
        for (li=0; li<(p-v1); li++) { p1[li] = v1[li]; }
        p1[li] = 0;
    }

    if (v2 == (MPI_Datarep_conversion_function *)mpi_conversion_fn_null_){
         v2 = 0;
    }

    if (v3 == (MPI_Datarep_conversion_function *)mpi_conversion_fn_null_){
         v3 = 0;
    }
    *ierr = MPI_Register_datarep( p1, v2, v3, v4, v5 );
    MPIU_Free( p1 );
#else
*ierr = MPI_ERR_INTERN;
#endif
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<resources>
	<dimen name="button_height">45.0dip</dimen>
	<dimen name="bottom_tab_font_size">10.0dip</dimen>
	<dimen name="bottom_tab_padding_up">5.0dip</dimen>
	<dimen name="bottom_tab_padding_drawable">2.0dip</dimen>
	<dimen name="switch_logo_bottom_padding">30.0sp</dimen>
	<dimen name="widget_height">100.0dip</dimen>
	<dimen name="sta_height">48.0dip</dimen>
	<dimen name="widget_write_margin_top">19.0dip</dimen>
	<dimen name="widget_write_margin_left">10.0dip</dimen>
	<dimen name="widget_content_margin_top">20.0dip</dimen>
	<dimen name="widget_content_margin_left">10.0dip</dimen>
	<dimen name="widget_logo_size">35.0dip</dimen>
	<dimen name="title_height">74.0dip</dimen>
	<dimen name="new_blog_size">70.0dip</dimen>
	<dimen name="searchbar_padding">5.0px</dimen>
	<dimen name="searchbar_textsize">24.0px</dimen>
	<dimen name="searchbar_paddingleft">30.0px</dimen>
	<dimen name="searchbar_paddingright">126.0px</dimen>
	<dimen name="searchbar_marginright">62.0px</dimen>
	<dimen name="searchbar_radiobutton_padding">40.0dip</dimen>
	<dimen name="searchbar_radiobutton_padding_user">55.0dip</dimen>
</resources>


text:
/**
 * @class
 * Tame and expose the opensocial.data.DataContext API to cajoled gadgets
 */
var tamings___ = tamings___ || [];
tamings___.push(function(imports) {
  caja___.whitelistFuncs([
    [opensocial.data, 'getDataContext'],
    [opensocial.data.DataContext, 'putDataSet']
  ]);
});


text:
namespace goplus
{
    struct GoDummy
    {
    };

    extern GoDummy go;

    template <typename Func>
    inline void operator + (GoDummy, Func f)
    {
        scheduler::spawn(f);
    }
}


text: java exercises work in progress


text:
package com.google.typography.font.tools.subsetter;

import com.google.typography.font.sfntly.Font;
import com.google.typography.font.sfntly.FontFactory;
import com.google.typography.font.sfntly.Tag;
import com.google.typography.font.sfntly.data.WritableFontData;
import com.google.typography.font.sfntly.table.core.MaximumProfileTable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Raph Levien
 */
public class RenumberingSubsetter extends Subsetter {

  {
    //There must be an order to the subsetting process.
    List<TableSubsetter> temp = new ArrayList<TableSubsetter>();//new HashSet<TableSubsetter>();
    temp.add(new GlyphTableSubsetter());
    temp.add(new RenumberingCMapTableSubsetter());
    temp.add(new PostScriptTableSubsetter());
    temp.add(new HorizontalMetricsTableSubsetter());
    //temp.add(new VerticalMetricsTableSubsetter());
    temp.add(new NameTableSubsetter());
    temp.add(new OS2TableSubsetter());
    temp.add(new HeadTableSubsetter());
    tableSubsetters = temp;
  }

  public RenumberingSubsetter(Font font, FontFactory fontFactory) {
    super(font, fontFactory);
  }

  @Override
  protected void setUpTables(Font.Builder fontBuilder) {
    fontBuilder.newTableBuilder(Tag.hhea, font.getTable(Tag.hhea).readFontData());
    if (font.getTable(Tag.maxp) == null) {
      MaximumProfileTable.Builder maxp = (MaximumProfileTable.Builder) fontBuilder.newTableBuilder(Tag.maxp);
      maxp.setData(WritableFontData.createWritableFontData(32));
      maxp.setTableVersion(0x00010000);

    } else {
      fontBuilder.newTableBuilder(Tag.maxp, font.getTable(Tag.maxp).readFontData());
    }
    if (font.getTable(Tag.OS_2) != null) {
      fontBuilder.newTableBuilder(Tag.OS_2, font.getTable(Tag.OS_2).readFontData());
    }
  }
}


text:
import React from 'react'
import { injectIntl, intlShape } from 'react-intl'
import SocialLink from './SocialLink'

const Social = props => {
  const { intl: { formatMessage } } = props
  const {
    fb,
    vk,
    ok
  } = require('./Social.messages').default // eslint-disable-line global-require
  // eslint-disable-next-line global-require
  const styles = require('./Social.css')

  const links = [
    {
      href: 'https://facebook.com',
      message: fb,
      key: 'fb'
    },
    {
      href: 'https://vk.com',
      message: vk,
      key: 'vk'
    },
    {
      href: 'https://ok.ru',
      message: ok,
      key: 'ok'
    }
  ]

  return (
    <div className={styles.container}>
      {links.map(options => (
        <SocialLink
          key={options.key}
          href={options.href}
          title={formatMessage(options.message)}
          icon={options.key}
        />
      ))}
    </div>
  )
}

Social.propTypes = {
  intl: intlShape
}

export default injectIntl(Social)


text:
<?php

namespace Api\Core;

use InvalidArgumentException;
use PDO;

/**
 *
 */
final class Menu extends Item {

    /**
     *
     *
     * @param string $name
     */
    public function __construct($name) {
        $sql = "SELECT * FROM menus WHERE name = :name AND status = 1";
        $stmt = Database::get()->prepare($sql);
        $stmt->bindValue(':name', $name);
        $stmt->execute();
        $res = $stmt->fetch(PDO::FETCH_ASSOC);
        if ($res === false) {
            throw new InvalidArgumentException("menu $name does not exists");
        }
        parent::__construct($res, ['name']);
    }

    /**
     *
     */
    public function getPages() {
        $sql = "SELECT * FROM pages WHERE mid = :mid AND status = 1";
        $stmt = Database::get()->prepare($sql);
        $stmt->bindValue(':mid', $this->get('id'));
        $stmt->execute();
        $pages = array();
        while ($res = $stmt->fetch(PDO::FETCH_ASSOC)) {
            array_push($pages, new Page($res));
        }
        return $pages;
    }

}


text:
"""empty message

Revision ID: 61150ffdf90e
Revises: 6a6005dc2d4c
Create Date: 2016-09-22 00:24:26.363101

"""

# revision identifiers, used by Alembic.
revision = '61150ffdf90e'
down_revision = '6a6005dc2d4c'

from alembic import op
import sqlalchemy as sa

def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.add_column('scivalue', sa.Column('amount', sa.Float(), nullable=True))
    ### end Alembic commands ###

def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_column('scivalue', 'amount')
    ### end Alembic commands ###


text:
package conf

import (
	"errors"
	"flag"
	"go-common/library/cache/redis"
	"go-common/library/conf"
	"go-common/library/database/orm"
	ecode "go-common/library/ecode/tip"
	"go-common/library/log"
	bm "go-common/library/net/http/blademaster"
	"go-common/library/net/http/blademaster/middleware/permit"
	"go-common/library/queue/databus"
	xtime "go-common/library/time"

	"github.com/BurntSushi/toml"
)

var (
	// config
	confPath string
	client   *conf.Client
	// Conf global config.
	Conf = &Config{}
)

// Config def.
type Config struct {
	// base
	Superman []string
	AppToken string
	//utBaseLine
	UTBaseLine *UTBaseLine
	// Host
	Host *Host
	// Canal
	Canal *Canal
	// log
	Log *log.Config
	// ecode
	Ecode *ecode.Config
	// client
	HTTPClient *bm.ClientConfig
	// db
	ORM *orm.Config
	// db databus
	ORMDatabus *orm.Config
	// db canal
	ORMCanal *orm.Config
	// kafka
	Kafka map[string]*Kafka
	// identify
	Auth *permit.Config
	// discovery
	Discovery *Discovery
	// tree
	Tree *Tree
	// databus kafka create topic config
	DatabusConfig *Databus
	//BM
	BM *bm.ServerConfig
	// ManagerReport
	ManagerReport *databus.Config
	// pprof
	Pprof *Pprof
	//Bfs
	Bfs        *Bfs
	Prometheus *Prometheus
	Apps       *Apps
	Cron       *Cron
	BroadCast  *BroadCast
	Gitlab     *Gitlab
	WeChat     *WeChat
	//Alarm
	Alarm *Alarm
	// Redis
	// Redis *redis.Config
	Redis *Redis
}

// Alarm .
type Alarm struct {
	DatabusURL string
	DatabusKey string
}

// WeChat .
type WeChat struct {
	Users  []string
	ChatID string
}

// BroadCast .
type BroadCast struct {
	TenCent  []string
	KingSoft []string
}

// Cron .
type Cron struct {
	Crontab     string
	CrontabRepo string
}

// Prometheus .
type Prometheus struct {
	URL    string
	Key    string
	Secret string
}

// Apps .
type Apps struct {
	Name []string
	Max  int64
}

//UTBaseLine .
type UTBaseLine struct {
	Coverage int
	Passrate int
}

// Bfs bfs config
type Bfs struct {
	Addr        string
	Bucket      string
	Key         string
	Secret      string
	MaxFileSize int
}

// Pprof dir path
type Pprof struct {
	Dir    string
	GoPath string
}

// Databus config
type Databus struct {
	Partitions int32
	Factor     int16
}

// Tree PlatformID
type Tree struct {
	PlatformID    string
	MsmPlatformID string
}

// Host hosts
type Host struct {
	APICo     string
	SVENCo    string
	MANAGERCo string
	DapperCo  string
}

//Canal canal
type Canal struct {
	CANALSVENCo string
	BUILD       string
	Reviewer    []string
}

// Discovery discovery
type Discovery struct {
	API []string
}

// Kafka kafka config
type Kafka struct {
	Brokers []string
}

// Gitlab gitlab config
type Gitlab struct {
	API   string // gitlab api host
	Token string // saga 账户 access token
}

// Redis .
type Redis struct {
	*redis.Config
	ExpireTime xtime.Duration
}

func local() (err error) {
	_, err = toml.DecodeFile(confPath, &Conf)
	return
}

func remote() (err error) {
	if client, err = conf.New(); err != nil {
		return
	}
	if err = load(); err != nil {
		return
	}
	go func() {
		for range client.Event() {
			log.Info("config reload")
			if load() != nil {
				log.Error("config reload error (%v)", err)
			}
		}
	}()
	return
}

func load() (err error) {
	var (
		s       string
		ok      bool
		tmpConf *Config
	)
	if s, ok = client.Toml2(); !ok {
		return errors.New("load config center error")
	}
	if _, err = toml.Decode(s, &tmpConf); err != nil {
		return errors.New("could not decode config")
	}
	*Conf = *tmpConf
	return
}

func init() {
	flag.StringVar(&confPath, "conf", "", "default config path")
}

// Init int config
func Init() error {
	if confPath != "" {
		return local()
	}
	return remote()
}


text:
//
// This code was auto-generated by AFNOR StoredProcedureSystem, version 1.0
//

using System.Runtime.Serialization;
using System;

namespace SOURCE.BackOffice.Web.ViewModels.ViewModels
{
    public partial class ServiceTokenViewModel
    {
    public long ID { get; set; }
    public string Token { get; set; }
    public DateTime DateExpiration { get; set; }
    public long UtilisateurID { get; set; }
    public Nullable<long> IdFonctionnel { get; set; }
    public string TypeCode { get; set; }
    public string OptionalParam { get; set; }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
org.apache.tools.ant.taskdefs.optional.native2ascii (Apache Ant API)
</TITLE>

<META NAME="keywords" CONTENT="org.apache.tools.ant.taskdefs.optional.native2ascii package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../../../stylesheet.css" TITLE="Style">

org.apache.tools.ant.taskdefs.optional.native2ascii

Interfaces

Native2AsciiAdapter

Classes

DefaultNative2Ascii

KaffeNative2Ascii

Native2AsciiAdapterFactory

SunNative2Ascii


text:
@keyframes hinge {
  0% {
    transform: rotate(0);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

  20%, 60% {
    transform: rotate(80deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

  40% {
    transform: rotate(60deg);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
  }

  80% {
    transform: rotate(60deg) translateY(0);
    transform-origin: top left;
    animation-timing-function: ease-in-out;
    opacity: 1;
  }

  100% {
    transform: translateY(700px);
    opacity: 0;
  }
}

.hinge {
  animation-name: hinge;
}


text:
namespace v8 {
namespace internal {

ReadOnlySerializer::ReadOnlySerializer(Isolate* isolate,
                                       Snapshot::SerializerFlags flags)
    : RootsSerializer(isolate, flags, RootIndex::kFirstReadOnlyRoot) {
  STATIC_ASSERT(RootIndex::kFirstReadOnlyRoot == RootIndex::kFirstRoot);
  allocator()->UseCustomChunkSize(FLAG_serialization_chunk_size);
}

ReadOnlySerializer::~ReadOnlySerializer() {
  OutputStatistics("ReadOnlySerializer");
}

void ReadOnlySerializer::SerializeObject(HeapObject obj) {
  CHECK(ReadOnlyHeap::Contains(obj));
  CHECK_IMPLIES(obj.IsString(), obj.IsInternalizedString());

  if (SerializeHotObject(obj)) return;
  if (IsRootAndHasBeenSerialized(obj) && SerializeRoot(obj)) {
    return;
  }
  if (SerializeBackReference(obj)) return;

  CheckRehashability(obj);

  // Object has not yet been serialized.  Serialize it here.
  ObjectSerializer object_serializer(this, obj, &sink_);
  object_serializer.Serialize();
#ifdef DEBUG
  serialized_objects_.insert(obj);
#endif
}

void ReadOnlySerializer::SerializeReadOnlyRoots() {
  // No active threads.
  CHECK_NULL(isolate()->thread_manager()->FirstThreadStateInUse());
  // No active or weak handles.
  CHECK_IMPLIES(!allow_active_isolate_for_testing(),
                isolate()->handle_scope_implementer()->blocks()->empty());

  ReadOnlyRoots(isolate()).Iterate(this);
}

void ReadOnlySerializer::FinalizeSerialization() {
  // This comes right after serialization of the other snapshots, where we
  // add entries to the read-only object cache. Add one entry with 'undefined'
  // to terminate the read-only object cache.
  Object undefined = ReadOnlyRoots(isolate()).undefined_value();
  VisitRootPointer(Root::kReadOnlyObjectCache, nullptr,
                   FullObjectSlot(&undefined));
  SerializeDeferredObjects();
  Pad();

#ifdef DEBUG
  // Check that every object on read-only heap is reachable (and was
  // serialized).
  ReadOnlyHeapObjectIterator iterator(isolate()->read_only_heap());
  for (HeapObject object = iterator.Next(); !object.is_null();
       object = iterator.Next()) {
    CHECK(serialized_objects_.count(object));
  }
#endif
}

bool ReadOnlySerializer::MustBeDeferred(HeapObject object) {
  if (root_has_been_serialized(RootIndex::kFreeSpaceMap) &&
      root_has_been_serialized(RootIndex::kOnePointerFillerMap) &&
      root_has_been_serialized(RootIndex::kTwoPointerFillerMap)) {
    // All required root objects are serialized, so any aligned objects can
    // be saved without problems.
    return false;
  }
  // Just defer everything except for Map objects until all required roots are
  // serialized. Some objects may have special alignment requirements, that may
  // not be fulfilled during deserialization until few first root objects are
  // serialized. But we must serialize Map objects since deserializer checks
  // that these root objects are indeed Maps.
  return !object.IsMap();
}

bool ReadOnlySerializer::SerializeUsingReadOnlyObjectCache(
    SnapshotByteSink* sink, HeapObject obj) {
  if (!ReadOnlyHeap::Contains(obj)) return false;

  // Get the cache index and serialize it into the read-only snapshot if
  // necessary.
  int cache_index = SerializeInObjectCache(obj);

  // Writing out the cache entry into the calling serializer's sink.
  sink->Put(kReadOnlyObjectCache, "ReadOnlyObjectCache");
  sink->PutInt(cache_index, "read_only_object_cache_index");

  return true;
}

}  // namespace internal
}  // namespace v8


text:
/* (C)opyleft 2001-2022 Frank DENIS <j at pureftpd dot org> */

#ifndef __PUREDB_READ_H__
#define __PUREDB_READ_H__ 1

#include <limits.h>

#define PUREDB_VERSION "PDB2"
#define PUREDB_LIB_VERSION 1

#ifndef PUREDB_U32_T
# if SHRT_MAX >= 2147483647
typedef unsigned short puredb_u32_t;
# elif INT_MAX >= 2147483647
typedef unsigned int puredb_u32_t;
# else
typedef unsigned long puredb_u32_t;
# endif
# define PUREDB_U32_T 1
#endif

typedef struct PureDB_ {
    unsigned char *map;
    int fd;
    puredb_u32_t size;
} PureDB;

#define puredb_getfd(X) ((X)->fd)

#define puredb_getsize(X) ((off_t) ((X)->size))

#define puredb_read_free(X) if ((X) != NULL) free(X)

int puredb_open(PureDB * const db, const char *dbfile);

int puredb_close(PureDB * const db);

int puredb_find(PureDB * const db, const char * const tofind,
                const size_t tofind_len, off_t * const retpos,
                size_t * const retlen);

int puredb_find_s(PureDB * const db, const char * const tofind,
                  off_t * const retpos, size_t * const retlen);

void *puredb_read(PureDB * const db, const off_t offset, const size_t len);

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:orientation="vertical"
    >
    <ImageView
        android:id="@+id/serviceImage"
        android:paddingLeft="5dp"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:layout_width="80dp"
        android:layout_height="80dp"
        />
    <TextView
        android:id="@+id/serviceName"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        />

</LinearLayout>


text:
<?php

     /***********************************************************************
     * index.php
     *
     * Edward M. Poot
     * edwardmp@gmail.com
     *
     * Problem Set 7
     *
     * Display's user's portfolio including realtime stock information.
     **********************************************************************/

    // configuration
    require("../includes/config.php");

    // retrieve user and stock data from db
    $query = query("SELECT u.*, s.* FROM users u LEFT OUTER JOIN user_stocks s ON u.id = s.user_id WHERE u.id = ?", $_SESSION["id"]);

    // if there is at least one stock in portfolio proceed
    if (isset($query[0]["symbol"]))
        // render portfolio
        render("portfolio.php", ["title" => "Portfolio", "stocks" => $query, "cash" => $query[0]["cash"]]);
    else
        apologize("You don't have any stocks in your portfolio. Buy some first!");
?>


text:
'use strict';

var async = require('async');

module.exports = {
	name: 'Creating Global moderators group',
	timestamp: Date.UTC(2016, 0, 23),
	method: function (callback) {
		var groups = require('../../groups');
		async.waterfall([
			function (next) {
				groups.exists('Global Moderators', next);
			},
			function (exists, next) {
				if (exists) {
					return next(null, null);
				}
				groups.create({
					name: 'Global Moderators',
					userTitle: 'Global Moderator',
					description: 'Forum wide moderators',
					hidden: 0,
					private: 1,
					disableJoinRequests: 1,
				}, next);
			},
			function (groupData, next) {
				groups.show('Global Moderators', next);
			},
		], callback);
	},
};


text:
class CreateNotesDiffFiles < ActiveRecord::Migration
  DOWNTIME = false

  disable_ddl_transaction!

  def change
    create_table :note_diff_files do |t|
      t.references :diff_note, references: :notes, null: false, index: { unique: true }
      t.text :diff, null: false
      t.boolean :new_file, null: false
      t.boolean :renamed_file, null: false
      t.boolean :deleted_file, null: false
      t.string :a_mode, null: false
      t.string :b_mode, null: false
      t.text :new_path, null: false
      t.text :old_path, null: false
    end

    # rubocop:disable Migration/AddConcurrentForeignKey
    add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade
  end
end


text:
#include "config.h"
#include "core/animation/DocumentAnimations.h"

#include "core/animation/AnimationClock.h"
#include "core/animation/AnimationTimeline.h"
#include "core/dom/Document.h"
#include "core/dom/Element.h"
#include "core/dom/Node.h"
#include "core/dom/NodeLayoutStyle.h"
#include "core/frame/FrameView.h"
#include "core/frame/LocalFrame.h"
#include "core/layout/LayoutView.h"
#include "core/layout/compositing/LayerCompositor.h"

namespace blink {

namespace {

void updateAnimationTiming(Document& document, TimingUpdateReason reason)
{
    document.timeline().serviceAnimations(reason);
}

} // namespace

void DocumentAnimations::updateAnimationTimingForAnimationFrame(Document& document, double monotonicAnimationStartTime)
{
    document.animationClock().updateTime(monotonicAnimationStartTime);
    updateAnimationTiming(document, TimingUpdateForAnimationFrame);
}

void DocumentAnimations::updateAnimationTimingIfNeeded(Document& document)
{
    if (needsOutdatedAnimationPlayerUpdate(document) || document.timeline().needsAnimationTimingUpdate())
        updateAnimationTiming(document, TimingUpdateOnDemand);
}

void DocumentAnimations::updateAnimationTimingForGetComputedStyle(Node& node, CSSPropertyID property)
{
    if (!node.isElementNode())
        return;
    const Element& element = toElement(node);
    if (LayoutStyle* style = element.layoutStyle()) {
        if ((property == CSSPropertyOpacity && style->isRunningOpacityAnimationOnCompositor())
            || ((property == CSSPropertyTransform || property == CSSPropertyWebkitTransform) && style->isRunningTransformAnimationOnCompositor())
            || (property == CSSPropertyWebkitFilter && style->isRunningFilterAnimationOnCompositor())) {
            updateAnimationTiming(element.document(), TimingUpdateOnDemand);
        }
    }
}

bool DocumentAnimations::needsOutdatedAnimationPlayerUpdate(const Document& document)
{
    return document.timeline().hasOutdatedAnimationPlayer();
}

void DocumentAnimations::updateCompositorAnimations(Document& document)
{
    ASSERT(document.lifecycle().state() == DocumentLifecycle::CompositingClean);
    if (document.compositorPendingAnimations().update()) {
        ASSERT(document.view());
        document.view()->scheduleAnimation();
    }

    document.timeline().scheduleNextService();
}

} // namespace blink


text:
<!DOCTYPE html>

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>colour.models.dataset.prophoto_rgb Module — Colour 0.3.6 documentation</title>

    <link rel="stylesheet" href="_static/basic.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootswatch-3.1.0/colour/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
    <link rel="stylesheet" href="_static/styles.css" type="text/css" />

    <link rel="top" title="Colour 0.3.6 documentation" href="index.html" />
    <link rel="up" title="colour.models.dataset Package" href="colour.models.dataset.html" />
    <link rel="next" title="colour.models.dataset.rec_2020 Module" href="colour.models.dataset.rec_2020.html" />
    <link rel="prev" title="colour.models.dataset.pointer_gamut Module" href="colour.models.dataset.pointer_gamut.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">

        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">

        </button>

          Colour 0.3

colour-science.org

                   Documentation

                           API Reference

                           IPython Notebooks

                           Features

                           Contributing

    « colour.models.da...

    colour.models.da... »

<form class="navbar-form navbar-right" action="search.html" method="get">

  <input type="text" name="q" class="form-control" placeholder="Search" />

  <input type="hidden" name="check_keywords" value="yes" />
  <input type="hidden" name="area" value="default" />
</form>

colour.models.dataset.prophoto_rgb Module¶

ProPhoto RGB Colourspace¶

Defines the ProPhoto RGB colourspace:

<tt class="xref py py-attr docutils literal">PROPHOTO_RGB_COLOURSPACE</tt>.

See also

RGB Colourspaces IPython Notebook

References

<colgroup><col class="label" /><col /></colgroup>

[1]	ANSI. (2003). Specification of ROMM RGB. Retrieved from
http://www.color.org/ROMMRGB.pdf

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_PRIMARIES</tt> = array([[  7.34700000e-01,   2.65300000e-01],        [  1.59600000e-01,   8.40400000e-01],        [  3.66000000e-02,   1.00000000e-04]])¶

ProPhoto RGB colourspace primaries.

PROPHOTO_RGB_PRIMARIES : ndarray, (3, 2)

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_ILLUMINANT</tt> = u'D50'¶

ProPhoto RGB colourspace whitepoint name as illuminant.

PROPHOTO_RGB_ILLUMINANT : unicode

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_WHITEPOINT</tt> = (0.34567, 0.3585)¶

ProPhoto RGB colourspace whitepoint.

PROPHOTO_RGB_WHITEPOINT : tuple

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_TO_XYZ_MATRIX</tt> = array([[  7.97667235e-01,   1.35192231e-01,   3.13525290e-02],        [  2.88037454e-01,   7.11876883e-01,   8.56626476e-05],        [  0.00000000e+00,   0.00000000e+00,   8.25188285e-01]])¶

ProPhoto RGB colourspace to CIE XYZ tristimulus values matrix.

PROPHOTO_RGB_TO_XYZ_MATRIX : array_like, (3, 3)

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">XYZ_TO_PROPHOTO_RGB_MATRIX</tt> = array([[ 1.34595631, -0.25560998, -0.05111226],        [-0.54459674,  1.50816142,  0.02053506],        [ 0.        ,  0.        ,  1.21184464]])¶

CIE XYZ tristimulus values to ProPhoto RGB colourspace matrix.

XYZ_TO_PROPHOTO_RGB_MATRIX : array_like, (3, 3)

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_TRANSFER_FUNCTION</tt><big>(</big>value<big>)</big>¶

Transfer function from linear to ProPhoto RGB colourspace.

PROPHOTO_RGB_TRANSFER_FUNCTION : object

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_INVERSE_TRANSFER_FUNCTION</tt><big>(</big>value<big>)</big>¶

Inverse transfer function from ProPhoto RGB colourspace to linear.

PROPHOTO_RGB_INVERSE_TRANSFER_FUNCTION : object

<tt class="descclassname">colour.models.dataset.prophoto_rgb.</tt><tt class="descname">PROPHOTO_RGB_COLOURSPACE</tt> = <colour.models.rgb.RGB_Colourspace object at 0x2abef9356510>¶

ProPhoto RGB colourspace.

PROPHOTO_RGB_COLOURSPACE : RGB_Colourspace

      Back to top

        © Copyright 2013 - 2015, Colour Developers.

      Created using Sphinx 1.2.2.


text:
require File.dirname(__FILE__) + '/../spec_helper'

describe Topic do
  define_models

  it "updates forum_id for posts when topic forum is changed" do
    topics(:default).update_attribute :forum, forums(:other)
    posts(:default).reload.forum.should == forums(:other)
  end

  it "leaves other topic post #forum_ids alone when updating forum" do
    topics(:default).update_attribute :forum, forums(:other)
    posts(:other).reload.forum.should == forums(:default)
  end

  it "doesn't update last_updated_at when updating topic" do
    current_date = topics(:default).last_updated_at
    topics(:default).last_updated_at.should == current_date
  end

  [:title, :profile_id, :forum_id].each do |attr|
    it "validates presence of #{attr}" do
      t = new_topic(:default)
      t.send("#{attr}=", nil)
      t.should_not be_valid
      t.errors.on(attr).should_not be_nil
    end
  end

  it "selects posts" do
    topics(:default).posts.should == [posts(:default)]
  end

  it "creates unsticky topic by default" do
    t = new_topic(:default)
    t.body = 'foo'
    t.sticky = nil
    t.save!
    t.should_not be_new_record
    t.should_not be_sticky
  end

  it "recognizes '1' as sticky" do
    topics(:default).should_not be_sticky
    topics(:default).sticky = 1
    topics(:default).should be_sticky
  end

  it "#hit! increments hits counter" do
    lambda { topics(:default).hit! }.should change { topics(:default).reload.hits }.by(1)
  end

  it "should know paged? status" do
    topics(:default).posts_count = 0
    topics(:default).should_not be_paged
    topics(:default).posts_count = Post.per_page + 5
    topics(:default).should be_paged
  end

  it "knows last page number based on posts count" do
    {0.0 => 1, 0.5 => 1, 1.0 => 1, 1.5 => 2}.each do |multiplier, last_page|
      topics(:default).posts_count = (Post.per_page.to_f * multiplier).ceil
      topics(:default).last_page.should == last_page
    end
  end

  it "doesn't allow new posts for locked topics" do
    @topic = topics(:default)
    @topic.locked = true ; @topic.save
    @post = @topic.profile.reply @topic, 'booya'
    @post.should be_new_record
    @post.errors.on(:base).should == 'Topic is locked'
  end
end

describe Topic, "being deleted" do
  define_models

  before do
    @topic = topics(:default)
    @deleting_topic = lambda { @topic.destroy }
  end

  it "deletes posts" do
    post = posts(:default).reload
    @deleting_topic.call
    lambda { post.reload }.should raise_error(ActiveRecord::RecordNotFound)
  end

  it "decrements Topic.count" do
    @deleting_topic.should change { Topic.count }.by(-1)
  end

  it "decrements Post.count" do
    @deleting_topic.should change { Post.count }.by(-1)
  end

  it "decrements cached forum topics_count" do
    @deleting_topic.should change { forums(:default).reload.topics_count }.by(-1)
  end

  it "decrements cached forum posts_count" do
    @deleting_topic.should change { forums(:default).reload.posts_count }.by(-1)
  end

  it "decrements cached group topics_count" do
    @deleting_topic.should change { groups(:default).reload.topics_count }.by(-1)
  end

  it "decrements cached group posts_count" do
    @deleting_topic.should change { groups(:default).reload.posts_count }.by(-1)
  end

  it "decrements cached profile posts_count" do
    @deleting_topic.should change { profiles(:default).reload.posts_count }.by(-1)
  end
end

describe Topic, "being moved to another forum" do
  define_models

  before do
    @forum     = forums(:default)
    @new_forum = forums(:other)
    @topic     = topics(:default)
    @moving_forum = lambda { @topic.forum = @new_forum ; @topic.save! }
  end

  it "decrements old forums cached topics_count" do
    @moving_forum.should change { @forum.reload.topics.size }.by(-1)
  end

  it "decrements old forums cached posts_count" do
    @moving_forum.should change { @forum.reload.posts.size }.by(-1)
  end

  it "increments new forums cached topics_count" do
    @moving_forum.should change { @new_forum.reload.topics.size }.by(1)
  end

  it "increments new forums cached posts_count" do
    @moving_forum.should change { @new_forum.reload.posts.size }.by(1)
  end

  it "moves posts to new forum" do
    @topic.posts.each { |p| p.forum.should == @forum }
    @moving_forum.call
    @topic.posts.each { |p| p.reload.forum.should == @new_forum }
  end
end

describe Topic, "#editable_by?" do
  before do
    @profile  = mock_model Profile
    @topic = Topic.new :forum => @forum
    @forum = mock_model(Forum)
  end

  it "restricts profile for other topic" do
    @profile.should_receive(:moderator_of?).and_return(false)
    @topic.should_not be_editable_by(@profile)
  end

  it "allows profile" do
    @topic.profile_id = @profile.id
    @topic.should be_editable_by(@profile)
  end

  it "allows moderator" do
    @topic.should_receive(:forum).and_return(@forum)
    @profile.should_receive(:moderator_of?).with(@forum).and_return(true)
    # @topic.forum_id = 2
    @topic.should be_editable_by(@profile)
  end
end


text:
a work-in-progress facebook chatbot, with the aim of transforming it into a beautiful artificial girlfriend

***
###### code by regina chen