text:
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
#include <linux/ctype.h>
#include <linux/spinlock.h>
#include <linux/interrupt.h>
#include <asm/uaccess.h>
#include <asm/ebcdic.h>
#include <asm/extmem.h>
#include <linux/poll.h>
#include "../net/iucv.h"

//#define MON_DEBUG			/* Debug messages on/off */

#define MON_NAME "monreader"

#define P_INFO(x...)	printk(KERN_INFO MON_NAME " info: " x)
#define P_ERROR(x...)	printk(KERN_ERR MON_NAME " error: " x)
#define P_WARNING(x...)	printk(KERN_WARNING MON_NAME " warning: " x)

#ifdef MON_DEBUG
#define P_DEBUG(x...)   printk(KERN_DEBUG MON_NAME " debug: " x)
#else
#define P_DEBUG(x...)   do {} while (0)
#endif

#define MON_COLLECT_SAMPLE 0x80
#define MON_COLLECT_EVENT  0x40
#define MON_SERVICE	   "*MONITOR"
#define MON_IN_USE	   0x01
#define MON_MSGLIM	   255

static char mon_dcss_name[9] = "MONDCSS\0";

struct mon_msg {
	u32 pos;
	u32 mca_offset;
	iucv_MessagePending local_eib;
	char msglim_reached;
	char replied_msglim;
};

struct mon_private {
	u16 pathid;
	iucv_handle_t iucv_handle;
	struct mon_msg *msg_array[MON_MSGLIM];
	unsigned int   write_index;
	unsigned int   read_index;
	atomic_t msglim_count;
	atomic_t read_ready;
	atomic_t iucv_connected;
	atomic_t iucv_severed;
};

static unsigned long mon_in_use = 0;

static unsigned long mon_dcss_start;
static unsigned long mon_dcss_end;

static DECLARE_WAIT_QUEUE_HEAD(mon_read_wait_queue);
static DECLARE_WAIT_QUEUE_HEAD(mon_conn_wait_queue);

static u8 iucv_host[8] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

static u8 user_data_connect[16] = {
	/* Version code, must be 0x01 for shared mode */
	0x01,
	/* what to collect */
	MON_COLLECT_SAMPLE | MON_COLLECT_EVENT,
	/* DCSS name in EBCDIC, 8 bytes padded with blanks */
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};

static u8 user_data_sever[16] = {
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
	0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
};

/******************************************************************************
 *                             helper functions                               *
 *****************************************************************************/
/*
 * Create the 8 bytes EBCDIC DCSS segment name from
 * an ASCII name, incl. padding
 */
static inline void
dcss_mkname(char *ascii_name, char *ebcdic_name)
{
	int i;

	for (i = 0; i < 8; i++) {
		if (ascii_name[i] == '\0')
			break;
		ebcdic_name[i] = toupper(ascii_name[i]);
	};
	for (; i < 8; i++)
		ebcdic_name[i] = ' ';
	ASCEBC(ebcdic_name, 8);
}

/*
 * print appropriate error message for segment_load()/segment_type()
 * return code
 */
static void
mon_segment_warn(int rc, char* seg_name)
{
	switch (rc) {
	case -ENOENT:
		P_WARNING("cannot load/query segment %s, does not exist\n",
			  seg_name);
		break;
	case -ENOSYS:
		P_WARNING("cannot load/query segment %s, not running on VM\n",
			  seg_name);
		break;
	case -EIO:
		P_WARNING("cannot load/query segment %s, hardware error\n",
			  seg_name);
		break;
	case -ENOTSUPP:
		P_WARNING("cannot load/query segment %s, is a multi-part "
			  "segment\n", seg_name);
		break;
	case -ENOSPC:
		P_WARNING("cannot load/query segment %s, overlaps with "
			  "storage\n", seg_name);
		break;
	case -EBUSY:
		P_WARNING("cannot load/query segment %s, overlaps with "
			  "already loaded dcss\n", seg_name);
		break;
	case -EPERM:
		P_WARNING("cannot load/query segment %s, already loaded in "
			  "incompatible mode\n", seg_name);
		break;
	case -ENOMEM:
		P_WARNING("cannot load/query segment %s, out of memory\n",
			  seg_name);
		break;
	case -ERANGE:
		P_WARNING("cannot load/query segment %s, exceeds kernel "
			  "mapping range\n", seg_name);
		break;
	default:
		P_WARNING("cannot load/query segment %s, return value %i\n",
			  seg_name, rc);
		break;
	}
}

static inline unsigned long
mon_mca_start(struct mon_msg *monmsg)
{
	return monmsg->local_eib.ln1msg1.iprmmsg1_u32;
}

static inline unsigned long
mon_mca_end(struct mon_msg *monmsg)
{
	return monmsg->local_eib.ln1msg2.ipbfln1f;
}

static inline u8
mon_mca_type(struct mon_msg *monmsg, u8 index)
{
	return *((u8 *) mon_mca_start(monmsg) + monmsg->mca_offset + index);
}

static inline u32
mon_mca_size(struct mon_msg *monmsg)
{
	return mon_mca_end(monmsg) - mon_mca_start(monmsg) + 1;
}

static inline u32
mon_rec_start(struct mon_msg *monmsg)
{
	return *((u32 *) (mon_mca_start(monmsg) + monmsg->mca_offset + 4));
}

static inline u32
mon_rec_end(struct mon_msg *monmsg)
{
	return *((u32 *) (mon_mca_start(monmsg) + monmsg->mca_offset + 8));
}

static inline int
mon_check_mca(struct mon_msg *monmsg)
{
	if ((mon_rec_end(monmsg) <= mon_rec_start(monmsg)) ||
	    (mon_rec_start(monmsg) < mon_dcss_start) ||
	    (mon_rec_end(monmsg) > mon_dcss_end) ||
	    (mon_mca_type(monmsg, 0) == 0) ||
	    (mon_mca_size(monmsg) % 12 != 0) ||
	    (mon_mca_end(monmsg) <= mon_mca_start(monmsg)) ||
	    (mon_mca_end(monmsg) > mon_dcss_end) ||
	    (mon_mca_start(monmsg) < mon_dcss_start) ||
	    ((mon_mca_type(monmsg, 1) == 0) && (mon_mca_type(monmsg, 2) == 0)))
	{
		P_DEBUG("READ, IGNORED INVALID MCA\n\n");
		return -EINVAL;
	}
	return 0;
}

static inline int
mon_send_reply(struct mon_msg *monmsg, struct mon_private *monpriv)
{
	u8 prmmsg[8];
	int rc;

	P_DEBUG("read, REPLY: pathid = 0x%04X, msgid = 0x%08X, trgcls = "
		"0x%08X\n\n",
		monmsg->local_eib.ippathid, monmsg->local_eib.ipmsgid,
		monmsg->local_eib.iptrgcls);
	rc = iucv_reply_prmmsg(monmsg->local_eib.ippathid,
				monmsg->local_eib.ipmsgid,
				monmsg->local_eib.iptrgcls,
				0, prmmsg);
	atomic_dec(&monpriv->msglim_count);
	if (likely(!monmsg->msglim_reached)) {
		monmsg->pos = 0;
		monmsg->mca_offset = 0;
		monpriv->read_index = (monpriv->read_index + 1) %
				      MON_MSGLIM;
		atomic_dec(&monpriv->read_ready);
	} else
		monmsg->replied_msglim = 1;
	if (rc) {
		P_ERROR("read, IUCV reply failed with rc = %i\n\n", rc);
		return -EIO;
	}
	return 0;
}

static inline struct mon_private *
mon_alloc_mem(void)
{
	int i,j;
	struct mon_private *monpriv;

	monpriv = kmalloc(sizeof(struct mon_private), GFP_KERNEL);
	if (!monpriv) {
		P_ERROR("no memory for monpriv\n");
		return NULL;
	}
	memset(monpriv, 0, sizeof(struct mon_private));
	for (i = 0; i < MON_MSGLIM; i++) {
		monpriv->msg_array[i] = kmalloc(sizeof(struct mon_msg),
						    GFP_KERNEL);
		if (!monpriv->msg_array[i]) {
			P_ERROR("open, no memory for msg_array\n");
			for (j = 0; j < i; j++)
				kfree(monpriv->msg_array[j]);
			return NULL;
		}
		memset(monpriv->msg_array[i], 0, sizeof(struct mon_msg));
	}
	return monpriv;
}

static inline void
mon_read_debug(struct mon_msg *monmsg, struct mon_private *monpriv)
{
#ifdef MON_DEBUG
	u8 msg_type[2], mca_type;
	unsigned long records_len;

	records_len = mon_rec_end(monmsg) - mon_rec_start(monmsg) + 1;

	memcpy(msg_type, &monmsg->local_eib.iptrgcls, 2);
	EBCASC(msg_type, 2);
	mca_type = mon_mca_type(monmsg, 0);
	EBCASC(&mca_type, 1);

	P_DEBUG("read, mon_read_index = %i, mon_write_index = %i\n",
		monpriv->read_index, monpriv->write_index);
	P_DEBUG("read, pathid = 0x%04X, msgid = 0x%08X, trgcls = 0x%08X\n",
		monmsg->local_eib.ippathid, monmsg->local_eib.ipmsgid,
		monmsg->local_eib.iptrgcls);
	P_DEBUG("read, msg_type = '%c%c', mca_type = '%c' / 0x%X / 0x%X\n",
		msg_type[0], msg_type[1], mca_type ? mca_type : 'X',
		mon_mca_type(monmsg, 1), mon_mca_type(monmsg, 2));
	P_DEBUG("read, MCA: start = 0x%lX, end = 0x%lX\n",
		mon_mca_start(monmsg), mon_mca_end(monmsg));
	P_DEBUG("read, REC: start = 0x%X, end = 0x%X, len = %lu\n\n",
		mon_rec_start(monmsg), mon_rec_end(monmsg), records_len);
	if (mon_mca_size(monmsg) > 12)
		P_DEBUG("READ, MORE THAN ONE MCA\n\n");
#endif
}

static inline void
mon_next_mca(struct mon_msg *monmsg)
{
	if (likely((mon_mca_size(monmsg) - monmsg->mca_offset) == 12))
		return;
	P_DEBUG("READ, NEXT MCA\n\n");
	monmsg->mca_offset += 12;
	monmsg->pos = 0;
}

static inline struct mon_msg *
mon_next_message(struct mon_private *monpriv)
{
	struct mon_msg *monmsg;

	if (!atomic_read(&monpriv->read_ready))
		return NULL;
	monmsg = monpriv->msg_array[monpriv->read_index];
	if (unlikely(monmsg->replied_msglim)) {
		monmsg->replied_msglim = 0;
		monmsg->msglim_reached = 0;
		monmsg->pos = 0;
		monmsg->mca_offset = 0;
		P_WARNING("read, message limit reached\n");
		monpriv->read_index = (monpriv->read_index + 1) %
				      MON_MSGLIM;
		atomic_dec(&monpriv->read_ready);
		return ERR_PTR(-EOVERFLOW);
	}
	return monmsg;
}

/******************************************************************************
 *                               IUCV handler                                 *
 *****************************************************************************/
static void
mon_iucv_ConnectionComplete(iucv_ConnectionComplete *eib, void *pgm_data)
{
	struct mon_private *monpriv = (struct mon_private *) pgm_data;

	P_DEBUG("IUCV connection completed\n");
	P_DEBUG("IUCV ACCEPT (from *MONITOR): Version = 0x%02X, Event = "
		"0x%02X, Sample = 0x%02X\n",
		eib->ipuser[0], eib->ipuser[1], eib->ipuser[2]);
	atomic_set(&monpriv->iucv_connected, 1);
	wake_up(&mon_conn_wait_queue);
}

static void
mon_iucv_ConnectionSevered(iucv_ConnectionSevered *eib, void *pgm_data)
{
	struct mon_private *monpriv = (struct mon_private *) pgm_data;

	P_ERROR("IUCV connection severed with rc = 0x%X\n",
		(u8) eib->ipuser[0]);
	atomic_set(&monpriv->iucv_severed, 1);
	wake_up(&mon_conn_wait_queue);
	wake_up_interruptible(&mon_read_wait_queue);
}

static void
mon_iucv_MessagePending(iucv_MessagePending *eib, void *pgm_data)
{
	struct mon_private *monpriv = (struct mon_private *) pgm_data;

	P_DEBUG("IUCV message pending\n");
	memcpy(&monpriv->msg_array[monpriv->write_index]->local_eib, eib,
	       sizeof(iucv_MessagePending));
	if (atomic_inc_return(&monpriv->msglim_count) == MON_MSGLIM) {
		P_WARNING("IUCV message pending, message limit (%i) reached\n",
			  MON_MSGLIM);
		monpriv->msg_array[monpriv->write_index]->msglim_reached = 1;
	}
	monpriv->write_index = (monpriv->write_index + 1) % MON_MSGLIM;
	atomic_inc(&monpriv->read_ready);
	wake_up_interruptible(&mon_read_wait_queue);
}

static iucv_interrupt_ops_t mon_iucvops = {
	.ConnectionComplete = mon_iucv_ConnectionComplete,
	.ConnectionSevered  = mon_iucv_ConnectionSevered,
	.MessagePending     = mon_iucv_MessagePending,
};

/******************************************************************************
 *                               file operations                              *
 *****************************************************************************/
static int
mon_open(struct inode *inode, struct file *filp)
{
	int rc, i;
	struct mon_private *monpriv;

	/*
	 * only one user allowed
	 */
	if (test_and_set_bit(MON_IN_USE, &mon_in_use))
		return -EBUSY;

	monpriv = mon_alloc_mem();
	if (!monpriv)
		return -ENOMEM;

	/*
	 * Register with IUCV and connect to *MONITOR service
	 */
	monpriv->iucv_handle = iucv_register_program("my_monreader    ",
							MON_SERVICE,
							NULL,
							&mon_iucvops,
							monpriv);
	if (!monpriv->iucv_handle) {
		P_ERROR("failed to register with iucv driver\n");
		rc = -EIO;
		goto out_error;
	}
	P_INFO("open, registered with IUCV\n");

	rc = iucv_connect(&monpriv->pathid, MON_MSGLIM, user_data_connect,
			  MON_SERVICE, iucv_host, IPRMDATA, NULL, NULL,
			  monpriv->iucv_handle, NULL);
	if (rc) {
		P_ERROR("iucv connection to *MONITOR failed with "
			"IPUSER SEVER code = %i\n", rc);
		rc = -EIO;
		goto out_unregister;
	}
	/*
	 * Wait for connection confirmation
	 */
	wait_event(mon_conn_wait_queue,
		   atomic_read(&monpriv->iucv_connected) ||
		   atomic_read(&monpriv->iucv_severed));
	if (atomic_read(&monpriv->iucv_severed)) {
		atomic_set(&monpriv->iucv_severed, 0);
		atomic_set(&monpriv->iucv_connected, 0);
		rc = -EIO;
		goto out_unregister;
	}
	P_INFO("open, established connection to *MONITOR service\n\n");
	filp->private_data = monpriv;
	return nonseekable_open(inode, filp);

out_unregister:
	iucv_unregister_program(monpriv->iucv_handle);
out_error:
	for (i = 0; i < MON_MSGLIM; i++)
		kfree(monpriv->msg_array[i]);
	kfree(monpriv);
	clear_bit(MON_IN_USE, &mon_in_use);
	return rc;
}

static int
mon_close(struct inode *inode, struct file *filp)
{
	int rc, i;
	struct mon_private *monpriv = filp->private_data;

	/*
	 * Close IUCV connection and unregister
	 */
	rc = iucv_sever(monpriv->pathid, user_data_sever);
	if (rc)
		P_ERROR("close, iucv_sever failed with rc = %i\n", rc);
	else
		P_INFO("close, terminated connection to *MONITOR service\n");

	rc = iucv_unregister_program(monpriv->iucv_handle);
	if (rc)
		P_ERROR("close, iucv_unregister failed with rc = %i\n", rc);
	else
		P_INFO("close, unregistered with IUCV\n");

	atomic_set(&monpriv->iucv_severed, 0);
	atomic_set(&monpriv->iucv_connected, 0);
	atomic_set(&monpriv->read_ready, 0);
	atomic_set(&monpriv->msglim_count, 0);
	monpriv->write_index  = 0;
	monpriv->read_index   = 0;

	for (i = 0; i < MON_MSGLIM; i++)
		kfree(monpriv->msg_array[i]);
	kfree(monpriv);
	clear_bit(MON_IN_USE, &mon_in_use);
	return 0;
}

static ssize_t
mon_read(struct file *filp, char __user *data, size_t count, loff_t *ppos)
{
	struct mon_private *monpriv = filp->private_data;
	struct mon_msg *monmsg;
	int ret;
	u32 mce_start;

	monmsg = mon_next_message(monpriv);
	if (IS_ERR(monmsg))
		return PTR_ERR(monmsg);

	if (!monmsg) {
		if (filp->f_flags & O_NONBLOCK)
			return -EAGAIN;
		ret = wait_event_interruptible(mon_read_wait_queue,
					atomic_read(&monpriv->read_ready) ||
					atomic_read(&monpriv->iucv_severed));
		if (ret)
			return ret;
		if (unlikely(atomic_read(&monpriv->iucv_severed)))
			return -EIO;
		monmsg = monpriv->msg_array[monpriv->read_index];
	}

	if (!monmsg->pos) {
		monmsg->pos = mon_mca_start(monmsg) + monmsg->mca_offset;
		mon_read_debug(monmsg, monpriv);
	}
	if (mon_check_mca(monmsg))
		goto reply;

	/* read monitor control element (12 bytes) first */
	mce_start = mon_mca_start(monmsg) + monmsg->mca_offset;
	if ((monmsg->pos >= mce_start) && (monmsg->pos < mce_start + 12)) {
		count = min(count, (size_t) mce_start + 12 - monmsg->pos);
		ret = copy_to_user(data, (void *) (unsigned long) monmsg->pos,
				   count);
		if (ret)
			return -EFAULT;
		monmsg->pos += count;
		if (monmsg->pos == mce_start + 12)
			monmsg->pos = mon_rec_start(monmsg);
		goto out_copy;
	}

	/* read records */
	if (monmsg->pos <= mon_rec_end(monmsg)) {
		count = min(count, (size_t) mon_rec_end(monmsg) - monmsg->pos
					    + 1);
		ret = copy_to_user(data, (void *) (unsigned long) monmsg->pos,
				   count);
		if (ret)
			return -EFAULT;
		monmsg->pos += count;
		if (monmsg->pos > mon_rec_end(monmsg))
			mon_next_mca(monmsg);
		goto out_copy;
	}
reply:
	ret = mon_send_reply(monmsg, monpriv);
	return ret;

out_copy:
	*ppos += count;
	return count;
}

static unsigned int
mon_poll(struct file *filp, struct poll_table_struct *p)
{
	struct mon_private *monpriv = filp->private_data;

	poll_wait(filp, &mon_read_wait_queue, p);
	if (unlikely(atomic_read(&monpriv->iucv_severed)))
		return POLLERR;
	if (atomic_read(&monpriv->read_ready))
		return POLLIN | POLLRDNORM;
	return 0;
}

static struct file_operations mon_fops = {
	.owner   = THIS_MODULE,
	.open    = &mon_open,
	.release = &mon_close,
	.read    = &mon_read,
	.poll    = &mon_poll,
};

static struct miscdevice mon_dev = {
	.name       = "monreader",
	.devfs_name = "monreader",
	.fops       = &mon_fops,
	.minor      = MISC_DYNAMIC_MINOR,
};

/******************************************************************************
 *                              module init/exit                              *
 *****************************************************************************/
static int __init
mon_init(void)
{
	int rc;

	if (!MACHINE_IS_VM) {
		P_ERROR("not running under z/VM, driver not loaded\n");
		return -ENODEV;
	}

	rc = segment_type(mon_dcss_name);
	if (rc < 0) {
		mon_segment_warn(rc, mon_dcss_name);
		return rc;
	}
	if (rc != SEG_TYPE_SC) {
		P_ERROR("segment %s has unsupported type, should be SC\n",
			mon_dcss_name);
		return -EINVAL;
	}

	rc = segment_load(mon_dcss_name, SEGMENT_SHARED,
			  &mon_dcss_start, &mon_dcss_end);
	if (rc < 0) {
		mon_segment_warn(rc, mon_dcss_name);
		return -EINVAL;
	}
	dcss_mkname(mon_dcss_name, &user_data_connect[8]);

	rc = misc_register(&mon_dev);
	if (rc < 0 ) {
		P_ERROR("misc_register failed, rc = %i\n", rc);
		goto out;
	}
	P_INFO("Loaded segment %s from %p to %p, size = %lu Byte\n",
		mon_dcss_name, (void *) mon_dcss_start, (void *) mon_dcss_end,
		mon_dcss_end - mon_dcss_start + 1);
	return 0;

out:
	segment_unload(mon_dcss_name);
	return rc;
}

static void __exit
mon_exit(void)
{
	segment_unload(mon_dcss_name);
	WARN_ON(misc_deregister(&mon_dev) != 0);
	return;
}

module_init(mon_init);
module_exit(mon_exit);

module_param_string(mondcss, mon_dcss_name, 9, 0444);
MODULE_PARM_DESC(mondcss, "Name of DCSS segment to be used for *MONITOR "
		 "service, max. 8 chars. Default is MONDCSS");

MODULE_AUTHOR("Gerald Schaefer <geraldsc@de.ibm.com>");
MODULE_DESCRIPTION("Character device driver for reading z/VM "
		   "monitor service records.");
MODULE_LICENSE("GPL");


text:
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:padding="@dimen/dp_10">

        <TextView
            android:id="@+id/tab1_spread_w"
            android:layout_width="@dimen/dp_100"
            android:layout_height="@dimen/dp_100"
            android:layout_marginTop="@dimen/dp_10"
            android:background="#4897fa"
            android:gravity="center"
            android:outlineProvider="none"
            android:text="none"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@+id/tab2_spread_w"
            app:layout_constraintTop_toBottomOf="@id/tab1_spread" />

        <TextView
            android:id="@+id/tab2_spread_w"
            android:layout_width="@dimen/dp_100"
            android:layout_height="@dimen/dp_100"
            android:background="#4897fa"
            android:gravity="center"
            android:outlineProvider="background"
            android:text="background"
            app:layout_constraintBottom_toBottomOf="@id/tab1_spread_w"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintLeft_toRightOf="@id/tab1_spread_w"
            app:layout_constraintRight_toRightOf="parent" />

        <TextView
            android:id="@+id/tab3_spread_w"
            android:layout_width="@dimen/dp_100"
            android:layout_height="@dimen/dp_100"
            android:layout_marginTop="@dimen/dp_20"
            android:background="#4897fa"
            android:gravity="center"
            android:outlineProvider="bounds"
            android:text="bounds"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintLeft_toLeftOf="parent"
            app:layout_constraintRight_toLeftOf="@id/tab4_spread_w"
            app:layout_constraintTop_toBottomOf="@id/tab2_spread_w" />

        <TextView
            android:id="@+id/tab4_spread_w"
            android:layout_width="@dimen/dp_100"
            android:layout_height="@dimen/dp_100"
            android:background="#4897fa"
            android:gravity="center"
            android:outlineProvider="paddedBounds"
            android:text="paddedBounds"
            app:layout_constraintBottom_toBottomOf="@id/tab3_spread_w"
            app:layout_constraintHorizontal_chainStyle="spread"
            app:layout_constraintLeft_toRightOf="@id/tab3_spread_w"
            app:layout_constraintRight_toRightOf="parent" />

    </androidx.constraintlayout.widget.ConstraintLayout>

</androidx.core.widget.NestedScrollView>

redpajama_set_name: RedPajamaGithub


text:
<?php
if (!empty($_GET['symbol'])){
   $symbol=$_GET['symbol'];
}
else{
    $symbol="GRO";
}

//always use this username, otherwise you can't get results
$username="liang";

//This is password for you.
$password="iTermPageForLiang";

//Put your gene symbol here

$result = file_get_contents("https://biotm.cis.udel.edu/udelafc/getiTermPage.php?user=$username&pass=$password&gene=$symbol");

header( 'Location: '.$result );
die();

?>


text:
package com.appdynamics.openstack.requestbody.json;

import com.google.gson.annotations.SerializedName;

public class Personality
{
	@SerializedName("path")
	private String path;

	@SerializedName("contents")
	private String file;

	public String getPath()
	{
		return path;
	}

	public String getContent()
	{
		return file;
	}

	public void setPath(String path)
	{
		this.path = path;
	}

	public void setContent(byte[] file)
	{
		this.file = new String(file);
	}
}


text:
CloudCannon makes it REALLY easy to get any HTML template or theme live and client editable.

We shot a video to show you exactly how in less than 4 minutes.

CloudCannon is powerful enough and versatile enough to add CMS capability to any custom website built in HTML and CSS.

But just because you CAN bring fully custom websites to CloudCannon doesn't mean you have to.

You can bring any HTML template or theme on the web.

Start Bootstrap? Yessir.

Theme Forest? Yup.

Template Monster? Yes please.

HTML5 Up? Oh yea.

Creative Market? C'mon how many times I gotta say it? - YES.

In fact it's so easy to bring a template to CloudCannon AND make it updatable that I put this real time video together to show you how to do it in less than 4 minutes:

If you'd rather read, here's the steps:

I signed up for CloudCannon… [0:23]

…created a new site… [0:30]

…that has a folder now ready to receive my files. [0:47]

Then I headed over to Start Bootstrap and looked for their most popular templates… [0:55]

…and picked 'Grayscale'. [1:02]

I downloaded and unzipped the files… [1:12]

…then dragged and dropped those files into CloudCannon. [1:19]

When it was uploaded I opened up the Index file using the online editor… [2:05]

…and made all the copy on the front page editable by adding class="editable". [2:33]

Then I setup a password so that a client can gain access. [2:48]

I can see that all that juicy work is live on the web! [2:53]

I can also sign in to the client editor by adding "/update" to the site address… [3:03]

…and make some changes. [3:20]

Once I hit save I can leave the client editor and see that the changes are now on the live site. [3:40]

Bringing templates to CloudCannon is a great way to get websites turned around for clients really REALLY quickly, while still giving them all the power of a CMS and the ease of editing that CloudCannon allows.

What's more exciting is that if you bring a template and you want to start adapting it, you can see your changes live in the browser just by saving. Awesome huh!

If you've got any work you're proud of on CloudCannon that started from template reach out to us and tell us to give it a look. We might just have to rave about it.


text:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Some class description here...
 *
 * @package     KAWANI
 * @subpackage  subpackage
 * @category    category
 * @author      cristhian.kevin@systemantech.com
 * @link        http://systemantech.com
 */
class Employment_type_model extends MY_Model {

    protected $_table      = 'employment_types';
    protected $primary_key = 'id';
    protected $return_type = 'array';

    /**
     * Callbacks or Observers
     */
    protected $before_create = ['generate_date_created_status'];
    protected $after_get     = ['set_default_data'];
    protected $after_create  = ['write_audit_trail'];
    protected $after_update  = ['write_audit_trail'];

    protected function generate_date_created_status($employment_types)
    {
        $employment_types['active_status'] = 1;
        return $employment_types;
    }

    protected function set_default_data($employment_types)
    {
        $employment_types['active_status']  = ($employment_types['active_status'] == 1) ? 'Active' : 'Inactive';
        return $employment_types;
    }

    public function get_employment_types_by($param)
    {
        $query = $this->db;
        $query->select('employment_types.*');
        $query->order_by('type_name', 'asc');
        return $this->get_by($param);
    }

    public function get_many_employment_types_by($param)
    {
        $query = $this->db;
        $query->select('employment_types.*');
        $query->order_by('type_name', 'asc');
        return $this->get_many_by($param);
    }

    public function get_employment_types_all()
    {
        $query = $this->db;
        $query->select('employment_types.*');
        $query->order_by('employment_types.type_name', 'asc');
        return $this->get_all();
    }
}


text:
@protocol MapViewControllerDelegateProtocol
@required

- (NSUInteger)numberOfAnnotations;
- (id<MKAnnotation>)annotationAtIndex:(NSUInteger)index;
@end

@interface MapViewController : UIViewController
@property (nonatomic, weak)id<MapViewControllerDelegateProtocol> delegate;
- (void)reloadMapView;
@end


text:
/*! \file PTXOperand.h
	\author Andrew Kerr <arkerr@gatech.edu>
	\date Jan 15, 2009
	\brief internal representation of a PTX operand
*/

#ifndef IR_PTXOPERAND_H_INCLUDED
#define IR_PTXOPERAND_H_INCLUDED

#include <cstdint>
#include <string>
#include <vector>
#include <functional>
#include <ocelot/ir/interface/Instruction.h>

namespace ir {

	typedef uint8_t PTXU8;
	typedef uint16_t PTXU16;
	typedef uint32_t PTXU32;
	typedef uint64_t PTXU64;

	typedef int8_t PTXS8;
	typedef int16_t PTXS16;
	typedef int32_t PTXS32;
	typedef int64_t PTXS64;

	typedef float PTXF32;
	typedef double PTXF64;

	typedef PTXU8   PTXB8;
	typedef PTXU16  PTXB16;
	typedef PTXU32  PTXB32;
	typedef PTXU64  PTXB64;

	class PTXOperand {
	public:
		//! addressing mode of operand
		enum AddressMode {
			Register,			//! use as register variable
			Indirect,			//! indirect access
			Immediate,			//! treat as immediate value
			Address,			//! treat as addressable variable
			Label,				//! operand is a label
			Special,			//! special register
			ArgumentList,       //! treat as argument list for function call
			FunctionName,       //! operand is a function name
			BitBucket,			//! bit bucket register
			Invalid
		};

		/*! Type specifiers for instructions */
		enum DataType {
			TypeSpecifier_invalid = 0,
			s8,
			s16,
			s32,
			s64,
			u8,
			u16,
			u32,
			u64,
			f16,
			f32,
			f64,
			b8,
			b16,
			b32,
			b64,
			pred
		};

		/*!	Special register names */
		enum SpecialRegister {
			tid,
			ntid,
			laneId,
			warpId,
			nwarpId,
			warpSize,
			ctaId,
			nctaId,
			smId,
			nsmId,
			gridId,
			clock,
			clock64,
			lanemask_eq,
			lanemask_le,
			lanemask_lt,
			lanemask_ge,
			lanemask_gt,
			pm0,
			pm1,
			pm2,
			pm3,
			envreg0,
			envreg1,
			envreg2,
			envreg3,
			envreg4,
			envreg5,
			envreg6,
			envreg7,
			envreg8,
			envreg9,
			envreg10,
			envreg11,
			envreg12,
			envreg13,
			envreg14,
			envreg15,
			envreg16,
			envreg17,
			envreg18,
			envreg19,
			envreg20,
			envreg21,
			envreg22,
			envreg23,
			envreg24,
			envreg25,
			envreg26,
			envreg27,
			envreg28,
			envreg29,
			envreg30,
			envreg31,
			SpecialRegister_invalid
		};

		enum PredicateCondition {
			Pred,		//< instruction executes if predicate is true
			InvPred,	//< instruction executes if predicate is false
			PT,			//< predicate is always true
			nPT			//< predicate is always false
		};

		enum Vec {
			v1 = 1, 			//< scalar
			v2 = 2,				//< vector2
			v4 = 4				//< vector4
		};

		enum VectorIndex {
			iAll = 0, //! Refers to the complete vector
			ix = 1, //! Only refers to the x index of the vector
			iy = 2, //! Only refers to the y index of the vector
			iz = 3, //! Only refers to the z index of the vector
			iw = 4 //! Only refers to the w index of the vector
		};

		typedef std::vector<PTXOperand> Array;

		typedef Instruction::RegisterType RegisterType;

	public:
		static std::string toString(VectorIndex);
		static std::string toString(Vec);
		static std::string toString(DataType);
		static std::string toString(SpecialRegister);
		static std::string toString(AddressMode);
		static std::string toString(DataType, RegisterType);
		static bool isFloat(DataType);
		static bool isInt(DataType);
		static bool isSigned(DataType);
		static unsigned int bytes(DataType);
		static bool valid(DataType, DataType);
		static bool relaxedValid(DataType instructionType, DataType);
		static long long unsigned int maxInt(DataType type);
		static long long unsigned int minInt(DataType type);

	public:
		PTXOperand();
		PTXOperand(SpecialRegister r, VectorIndex i = iAll, DataType t = u32);
		PTXOperand(const std::string& label);
		PTXOperand(AddressMode m, DataType t, RegisterType r = 0,
			int o = 0, Vec v = v1);
		PTXOperand(AddressMode m, DataType t, const std::string& identifier,
			int o = 0, Vec v = v1);
		PTXOperand(AddressMode m, const std::string& identifier);

		template<typename T>
		PTXOperand(T v, DataType t);
		template<typename T>
		explicit PTXOperand(T v);

		~PTXOperand();

		std::string toString() const;
		std::string registerName() const;
		unsigned int bytes() const;
		bool isRegister() const;
		bool isVector() const;

		//! identifier of operand
		std::string identifier;

		//! addressing mode of operand
		AddressMode addressMode;

		//! data type for PTX instruction
		DataType type;
		DataType relaxedType;

		//!	offset when used with an indirect addressing mode
		union {
			int offset;
			VectorIndex vIndex;
			unsigned int registerCount;
		};

		//! immediate-mode value of operand
		union {
			long long unsigned int imm_uint;
			long long int imm_int;
			double imm_float;
			float  imm_single;
			PredicateCondition condition;
			SpecialRegister special;
			unsigned int localMemorySize;
		};

		union {
			/*! Identifier for register */
			RegisterType reg;
			bool isArgument;
			bool isGlobalLocal;
			unsigned int sharedMemorySize;
		};

		union {
			//! Indicates whether target or source is a vector or scalar
			Vec vec;
			unsigned int stackMemorySize;
		};

		//! Array if this is a vector
		Array array;

	};

}

namespace ir {
	template<typename T>
	PTXOperand::PTXOperand(T v, DataType t) : addressMode(Immediate), type(t),
		relaxedType(TypeSpecifier_invalid),
		offset(0), imm_uint(v), reg(0), vec(v1) {}

	template<typename T>
	PTXOperand::PTXOperand(T v) : addressMode(Immediate), type(u64),
		relaxedType(TypeSpecifier_invalid),
		offset(0), imm_uint(v), reg(0), vec(v1) {}

	template<> inline
	PTXOperand::PTXOperand(float v) : addressMode(Immediate), type(f32),
		relaxedType(TypeSpecifier_invalid),
		offset(0), imm_single(v), reg(0), vec(v1) {
	}

	template<> inline
	PTXOperand::PTXOperand(double v) : addressMode(Immediate),
		type(f64), relaxedType(TypeSpecifier_invalid),
		offset(0), imm_float(v), reg(0), vec(v1) {
	}
}

namespace std {
	template<>
	struct hash<ir::PTXOperand::DataType> {
	public:
		size_t operator()(const ir::PTXOperand::DataType& t) const {
			return (size_t)t;
		}
	};
}

#endif


text:
#import "RCTComponentData.h"

#import <objc/message.h>

#import "RCTBridge.h"
#import "RCTBridgeModule.h"
#import "RCTComponentEvent.h"
#import "RCTConstants.h"
#import "RCTConvert.h"
#import "RCTEventDispatcherProtocol.h"
#import "RCTParserUtils.h"
#import "RCTShadowView.h"
#import "RCTUtils.h"
#import "UIView+React.h"

typedef void (^RCTPropBlock)(id<RCTComponent> view, id json);
typedef NSMutableDictionary<NSString *, RCTPropBlock> RCTPropBlockDictionary;
typedef void (^InterceptorBlock)(NSString *eventName, NSDictionary *event, id sender);

/**
 * Get the converter function for the specified type
 */
static SEL selectorForType(NSString *type)
{
  const char *input = type.UTF8String;
  return NSSelectorFromString([RCTParseType(&input) stringByAppendingString:@":"]);
}

@implementation RCTComponentData {
  id<RCTComponent> _defaultView; // Only needed for RCT_CUSTOM_VIEW_PROPERTY
  RCTPropBlockDictionary *_viewPropBlocks;
  RCTPropBlockDictionary *_shadowPropBlocks;
  __weak RCTBridge *_bridge;
  __weak id<RCTEventDispatcherProtocol> _eventDispatcher;
}

@synthesize manager = _manager;
@synthesize bridgelessViewManager = _bridgelessViewManager;

- (instancetype)initWithManagerClass:(Class)managerClass
                              bridge:(RCTBridge *)bridge
                     eventDispatcher:(id<RCTEventDispatcherProtocol>)eventDispatcher
{
  if ((self = [super init])) {
    _bridge = bridge;
    _eventDispatcher = eventDispatcher;
    _managerClass = managerClass;
    _viewPropBlocks = [NSMutableDictionary new];
    _shadowPropBlocks = [NSMutableDictionary new];

    _name = moduleNameForClass(managerClass);
  }
  return self;
}

- (RCTViewManager *)manager
{
  if (!_manager && _bridge) {
    _manager = [_bridge moduleForClass:_managerClass];
  } else if (!_manager && !_bridgelessViewManager) {
    _bridgelessViewManager = [_managerClass new];
    [[NSNotificationCenter defaultCenter] postNotificationName:RCTDidInitializeModuleNotification
                                                        object:nil
                                                      userInfo:@{@"module" : _bridgelessViewManager}];
  }
  return _manager ?: _bridgelessViewManager;
}

RCT_NOT_IMPLEMENTED(-(instancetype)init)

- (UIView *)createViewWithTag:(nullable NSNumber *)tag rootTag:(nullable NSNumber *)rootTag
{
  RCTAssertMainQueue();

  UIView *view = [self.manager view];
  view.reactTag = tag;
  view.rootTag = rootTag;
  view.multipleTouchEnabled = YES;
  view.userInteractionEnabled = YES; // required for touch handling
  view.layer.allowsGroupOpacity = YES; // required for touch handling
  return view;
}

- (RCTShadowView *)createShadowViewWithTag:(NSNumber *)tag
{
  RCTShadowView *shadowView = [self.manager shadowView];
  shadowView.reactTag = tag;
  shadowView.viewName = _name;
  return shadowView;
}

- (void)callCustomSetter:(SEL)setter onView:(id<RCTComponent>)view withProp:(id)json isShadowView:(BOOL)isShadowView
{
  json = RCTNilIfNull(json);
  if (!isShadowView) {
    if (!json && !_defaultView) {
      // Only create default view if json is null
      _defaultView = [self createViewWithTag:nil rootTag:nil];
    }
    ((void (*)(id, SEL, id, id, id))objc_msgSend)(self.manager, setter, json, view, _defaultView);
  } else {
    ((void (*)(id, SEL, id, id))objc_msgSend)(self.manager, setter, json, view);
  }
}

static RCTPropBlock createEventSetter(
    NSString *propName,
    SEL setter,
    InterceptorBlock eventInterceptor,
    id<RCTEventDispatcherProtocol> eventDispatcher)
{
  __weak id<RCTEventDispatcherProtocol> weakEventDispatcher = eventDispatcher;
  return ^(id target, id json) {
    void (^eventHandler)(NSDictionary *event) = nil;
    if ([RCTConvert BOOL:json]) {
      __weak id<RCTComponent> weakTarget = target;
      eventHandler = ^(NSDictionary *event) {
        // The component no longer exists, we shouldn't send the event
        id<RCTComponent> strongTarget = weakTarget;
        if (!strongTarget) {
          return;
        }

        if (eventInterceptor) {
          eventInterceptor(propName, event, strongTarget.reactTag);
        } else {
          RCTComponentEvent *componentEvent = [[RCTComponentEvent alloc] initWithName:propName
                                                                              viewTag:strongTarget.reactTag
                                                                                body:event];
          [weakEventDispatcher sendEvent:componentEvent];
        }
      };
    }
    ((void (*)(id, SEL, id))objc_msgSend)(target, setter, eventHandler);
  };
}

static RCTPropBlock createNSInvocationSetter(NSMethodSignature *typeSignature, SEL type, SEL getter, SEL setter)
{
  NSInvocation *typeInvocation = [NSInvocation invocationWithMethodSignature:typeSignature];
  typeInvocation.selector = type;
  typeInvocation.target = [RCTConvert class];

  __block NSInvocation *targetInvocation = nil;
  __block NSMutableData *defaultValue = nil;

  return ^(id target, id json) {
    if (!target) {
      return;
    }

    // Get default value
    if (!defaultValue) {
      if (!json) {
        // We only set the defaultValue when we first pass a non-null
        // value, so if the first value sent for a prop is null, it's
        // a no-op (we'd be resetting it to its default when its
        // value is already the default).
        return;
      }
      // Use NSMutableData to store defaultValue instead of malloc, so
      // it will be freed automatically when setterBlock is released.
      defaultValue = [[NSMutableData alloc] initWithLength:typeSignature.methodReturnLength];
      if ([target respondsToSelector:getter]) {
        NSMethodSignature *signature = [target methodSignatureForSelector:getter];
        NSInvocation *sourceInvocation = [NSInvocation invocationWithMethodSignature:signature];
        sourceInvocation.selector = getter;
        [sourceInvocation invokeWithTarget:target];
        [sourceInvocation getReturnValue:defaultValue.mutableBytes];
      }
    }

    // Get value
    BOOL freeValueOnCompletion = NO;
    void *value = defaultValue.mutableBytes;
    if (json) {
      freeValueOnCompletion = YES;
      value = malloc(typeSignature.methodReturnLength);
      if (!value) {
        // CWE - 391 : Unchecked error condition
        // https://www.cvedetails.com/cwe-details/391/Unchecked-Error-Condition.html
        // https://eli.thegreenplace.net/2009/10/30/handling-out-of-memory-conditions-in-c
        abort();
      }
      [typeInvocation setArgument:&json atIndex:2];
      [typeInvocation invoke];
      [typeInvocation getReturnValue:value];
    }

    // Set value
    if (!targetInvocation) {
      NSMethodSignature *signature = [target methodSignatureForSelector:setter];
      targetInvocation = [NSInvocation invocationWithMethodSignature:signature];
      targetInvocation.selector = setter;
    }
    [targetInvocation setArgument:value atIndex:2];
    [targetInvocation invokeWithTarget:target];
    if (freeValueOnCompletion) {
      // Only free the value if we `malloc`d it locally, otherwise it
      // points to `defaultValue.mutableBytes`, which is managed by ARC.
      free(value);
    }
  };
}

- (RCTPropBlock)createPropBlock:(NSString *)name isShadowView:(BOOL)isShadowView
{
  // Get type
  SEL type = NULL;
  NSString *keyPath = nil;
  SEL selector =
      NSSelectorFromString([NSString stringWithFormat:@"propConfig%@_%@", isShadowView ? @"Shadow" : @"", name]);
  if ([_managerClass respondsToSelector:selector]) {
    NSArray<NSString *> *typeAndKeyPath = ((NSArray<NSString *> * (*)(id, SEL)) objc_msgSend)(_managerClass, selector);
    type = selectorForType(typeAndKeyPath[0]);
    keyPath = typeAndKeyPath.count > 1 ? typeAndKeyPath[1] : nil;
  } else {
    return ^(__unused id view, __unused id json) {
    };
  }

  // Check for custom setter
  if ([keyPath isEqualToString:@"__custom__"]) {
    // Get custom setter. There is no default view in the shadow case, so the selector is different.
    NSString *selectorString;
    if (!isShadowView) {
      selectorString =
          [NSString stringWithFormat:@"set_%@:for%@View:withDefaultView:", name, isShadowView ? @"Shadow" : @""];
    } else {
      selectorString = [NSString stringWithFormat:@"set_%@:forShadowView:", name];
    }

    SEL customSetter = NSSelectorFromString(selectorString);
    __weak RCTComponentData *weakSelf = self;
    return ^(id<RCTComponent> view, id json) {
      [weakSelf callCustomSetter:customSetter onView:view withProp:json isShadowView:isShadowView];
    };
  } else {
    // Disect keypath
    NSString *key = name;
    NSArray<NSString *> *parts = [keyPath componentsSeparatedByString:@"."];
    if (parts) {
      key = parts.lastObject;
      parts = [parts subarrayWithRange:(NSRange){0, parts.count - 1}];
    }

    // Get property getter
    SEL getter = NSSelectorFromString(key);

    // Get property setter
    SEL setter = NSSelectorFromString(
        [NSString stringWithFormat:@"set%@%@:", [key substringToIndex:1].uppercaseString, [key substringFromIndex:1]]);

    // Build setter block
    void (^setterBlock)(id target, id json) = nil;
    if (type == NSSelectorFromString(@"RCTBubblingEventBlock:") ||
        type == NSSelectorFromString(@"RCTDirectEventBlock:") ||
        type == NSSelectorFromString(@"RCTCapturingEventBlock:")) {
      // Special case for event handlers
      setterBlock =
          createEventSetter(name, setter, self.eventInterceptor, _bridge ? _bridge.eventDispatcher : _eventDispatcher);
    } else {
      // Ordinary property handlers
      NSMethodSignature *typeSignature = [[RCTConvert class] methodSignatureForSelector:type];
      if (!typeSignature) {
        RCTLogError(@"No +[RCTConvert %@] function found.", NSStringFromSelector(type));
        return ^(__unused id<RCTComponent> view, __unused id json) {
        };
      }
      switch (typeSignature.methodReturnType[0]) {
#define RCT_CASE(_value, _type)                                       \
  case _value: {                                                      \
    __block BOOL setDefaultValue = NO;                                \
    __block _type defaultValue;                                       \
    _type (*convert)(id, SEL, id) = (typeof(convert))objc_msgSend;    \
    _type (*get)(id, SEL) = (typeof(get))objc_msgSend;                \
    void (*set)(id, SEL, _type) = (typeof(set))objc_msgSend;          \
    setterBlock = ^(id target, id json) {                             \
      if (json) {                                                     \
        if (!setDefaultValue && target) {                             \
          if ([target respondsToSelector:getter]) {                   \
            defaultValue = get(target, getter);                       \
          }                                                           \
          setDefaultValue = YES;                                      \
        }                                                             \
        set(target, setter, convert([RCTConvert class], type, json)); \
      } else if (setDefaultValue) {                                   \
        set(target, setter, defaultValue);                            \
      }                                                               \
    };                                                                \
    break;                                                            \
  }

        RCT_CASE(_C_SEL, SEL)
        RCT_CASE(_C_CHARPTR, const char *)
        RCT_CASE(_C_CHR, char)
        RCT_CASE(_C_UCHR, unsigned char)
        RCT_CASE(_C_SHT, short)
        RCT_CASE(_C_USHT, unsigned short)
        RCT_CASE(_C_INT, int)
        RCT_CASE(_C_UINT, unsigned int)
        RCT_CASE(_C_LNG, long)
        RCT_CASE(_C_ULNG, unsigned long)
        RCT_CASE(_C_LNG_LNG, long long)
        RCT_CASE(_C_ULNG_LNG, unsigned long long)
        RCT_CASE(_C_FLT, float)
        RCT_CASE(_C_DBL, double)
        RCT_CASE(_C_BOOL, BOOL)
        RCT_CASE(_C_PTR, void *)
        RCT_CASE(_C_ID, id)

        case _C_STRUCT_B:
        default: {
          setterBlock = createNSInvocationSetter(typeSignature, type, getter, setter);
          break;
        }
      }
    }

    return ^(__unused id view, __unused id json) {
      // Follow keypath
      id target = view;
      for (NSString *part in parts) {
        target = [target valueForKey:part];
      }

      // Set property with json
      setterBlock(target, RCTNilIfNull(json));
    };
  }
}

- (RCTPropBlock)propBlockForKey:(NSString *)name isShadowView:(BOOL)isShadowView
{
  RCTPropBlockDictionary *propBlocks = isShadowView ? _shadowPropBlocks : _viewPropBlocks;
  RCTPropBlock propBlock = propBlocks[name];
  if (!propBlock) {
    propBlock = [self createPropBlock:name isShadowView:isShadowView];

#if RCT_DEBUG
    // Provide more useful log feedback if there's an error
    RCTPropBlock unwrappedBlock = propBlock;
    __weak __typeof(self) weakSelf = self;
    propBlock = ^(id<RCTComponent> view, id json) {
      NSString *logPrefix = [NSString
          stringWithFormat:@"Error setting property '%@' of %@ with tag #%@: ", name, weakSelf.name, view.reactTag];
      RCTPerformBlockWithLogPrefix(
          ^{
            unwrappedBlock(view, json);
          },
          logPrefix);
    };
#endif
    propBlocks[name] = [propBlock copy];
  }
  return propBlock;
}

- (void)setProps:(NSDictionary<NSString *, id> *)props forView:(id<RCTComponent>)view
{
  if (!view) {
    return;
  }

  [props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
    [self propBlockForKey:key isShadowView:NO](view, json);
  }];
}

- (void)setProps:(NSDictionary<NSString *, id> *)props forShadowView:(RCTShadowView *)shadowView
{
  if (!shadowView) {
    return;
  }

  [props enumerateKeysAndObjectsUsingBlock:^(NSString *key, id json, __unused BOOL *stop) {
    [self propBlockForKey:key isShadowView:YES](shadowView, json);
  }];
}

- (NSDictionary<NSString *, id> *)viewConfig
{
  NSMutableArray<NSString *> *bubblingEvents = [NSMutableArray new];
  NSMutableArray<NSString *> *capturingEvents = [NSMutableArray new];
  NSMutableArray<NSString *> *directEvents = [NSMutableArray new];

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
  if (RCTClassOverridesInstanceMethod(_managerClass, @selector(customBubblingEventTypes))) {
    NSArray<NSString *> *events = [self.manager customBubblingEventTypes];
    for (NSString *event in events) {
      [bubblingEvents addObject:RCTNormalizeInputEventName(event)];
    }
  }
#pragma clang diagnostic pop

  unsigned int count = 0;
  NSMutableDictionary *propTypes = [NSMutableDictionary new];
  Method *methods = class_copyMethodList(object_getClass(_managerClass), &count);
  for (unsigned int i = 0; i < count; i++) {
    SEL selector = method_getName(methods[i]);
    const char *selectorName = sel_getName(selector);
    if (strncmp(selectorName, "propConfig", strlen("propConfig")) != 0) {
      continue;
    }

    // We need to handle both propConfig_* and propConfigShadow_* methods
    const char *underscorePos = strchr(selectorName + strlen("propConfig"), '_');
    if (!underscorePos) {
      continue;
    }

    NSString *name = @(underscorePos + 1);
    NSString *type = ((NSArray<NSString *> * (*)(id, SEL)) objc_msgSend)(_managerClass, selector)[0];
    if (RCT_DEBUG && propTypes[name] && ![propTypes[name] isEqualToString:type]) {
      RCTLogError(
          @"Property '%@' of component '%@' redefined from '%@' "
           "to '%@'",
          name,
          _name,
          propTypes[name],
          type);
    }

    if ([type isEqualToString:@"RCTBubblingEventBlock"]) {
      [bubblingEvents addObject:RCTNormalizeInputEventName(name)];

      // TODO(109509380): Remove this gating
      if (!RCTViewConfigEventValidAttributesDisabled()) {
        propTypes[name] = @"BOOL";
      }
    } else if ([type isEqualToString:@"RCTCapturingEventBlock"]) {
      [capturingEvents addObject:RCTNormalizeInputEventName(name)];

      // TODO(109509380): Remove this gating
      if (!RCTViewConfigEventValidAttributesDisabled()) {
        propTypes[name] = @"BOOL";
      }
    } else if ([type isEqualToString:@"RCTDirectEventBlock"]) {
      [directEvents addObject:RCTNormalizeInputEventName(name)];

      // TODO(109509380): Remove this gating
      if (!RCTViewConfigEventValidAttributesDisabled()) {
        propTypes[name] = @"BOOL";
      }
    } else {
      propTypes[name] = type;
    }
  }
  free(methods);

#if RCT_DEBUG
  for (NSString *event in bubblingEvents) {
    if ([directEvents containsObject:event]) {
      RCTLogError(
          @"Component '%@' registered '%@' as both a bubbling event "
           "and a direct event",
          _name,
          event);
    }
  }
#endif

  Class superClass = [_managerClass superclass];

  return @{
    @"propTypes" : propTypes,
    @"directEvents" : directEvents,
    @"bubblingEvents" : bubblingEvents,
    @"capturingEvents" : capturingEvents,
    @"baseModuleName" : superClass == [NSObject class] ? (id)kCFNull : moduleNameForClass(superClass),
  };
}

static NSString *moduleNameForClass(Class managerClass)
{
  // Hackety hack, this partially re-implements RCTBridgeModuleNameForClass
  // We want to get rid of RCT and RK prefixes, but a lot of JS code still references
  // view names by prefix. So, while RCTBridgeModuleNameForClass now drops these
  // prefixes by default, we'll still keep them around here.
  NSString *name = [managerClass moduleName];
  if (name.length == 0) {
    name = NSStringFromClass(managerClass);
  }
  if ([name hasPrefix:@"RK"]) {
    name = [name stringByReplacingCharactersInRange:(NSRange){0, @"RK".length} withString:@"RCT"];
  }
  if ([name hasSuffix:@"Manager"]) {
    name = [name substringToIndex:name.length - @"Manager".length];
  }

  RCTAssert(name.length, @"Invalid moduleName '%@'", name);

  return name;
}

@end


text:
package org.opensextant.annotations.test;

import static org.junit.Assert.assertTrue;

import org.junit.Test;
import org.opensextant.annotations.Annotation;

import jodd.json.JsonParser;

public class TestAnnot {

    @Test
    public void test() {
        Annotation a = new Annotation();
        a.newAttributes();
        a.id = "scratch";
        a.name = "NAMEX";
        a.value = "Salamander X";
        a.offset = 0;
        System.out.println("Annotation as a map\t" + a.getMap());

        a = new Annotation();
        a.newAttributes();
        a.id = "scratch2";
        a.name = "ORG";
        a.value = "Salamander Assoc.";
        a.offset = -90;
        System.out.println("Annotation as a map\t" + a.getMap());

        a = new Annotation();
        a.newAttributes();
        a.id = "scratch2";
        a.rec_id = "Doc2";
        a.source_id = "test-docs";
        a.name = "ORG";
        a.value = "Salamander Assoc.";
        a.offset = 2290;
        a.attrs.put("k1", "v1");
        a.attrs.put("date", "2014-04-89");

        // Test for integers.
        int prec = -999;
        // a.attrs.put("prec", 7777);
        if (a.attrs.containsKey("prec")) {
            prec = a.attrs.getInteger("prec");
        }
        System.out.println("Prec, non-existent = " + prec);
        prec = a.attrs.getInteger("prec", -1);
        System.out.println("Prec, non-existent, default= " + prec);
        a.attrs.put("prec", 7000);
        prec = a.attrs.getInteger("prec");
        System.out.println("Prec, exists as integer =" + prec);
        prec = a.attrs.getInteger("prec", -1);
        System.out.println("Prec, exists as integer, w/default = " + prec);

        System.out.println("Annotation as a map\t" + a.getMap());

        // Test null.
        a.attrs = new JsonParser().parseAsJsonObject("{ }");
        System.out.println("Test Null Attrs\t" + a.getMap());
        // Test null.
        a.attrs = null;
        System.out.println("Test Null Attrs\t" + a.getMap());

        Annotation a1 = new Annotation("entity-testID", "Doc2", "Parser1", "ORG", "SalMonder");
        a1.newAttributes();
        a1.addOffset(80);
        a1.addOffset(4);
        a1.addOffset(2290);
        a1.attrs.put("k1", "v1");
        a1.attrs.put("date", "2014-04-89");

        System.out.println("Entity Annotation with multiple offsets as a map\t" + a1.getMap());

        a1.resetOffsets();
        System.out.println("Entity Annotation with no offsets\t" + a1.getMap());

        // Can we do it twice? check for nulls, etc.
        a1.attrs = null;
        a1.resetOffsets();

        a1.offset = 1001;
        System.out.println("Entity Annotation with one offset\t" + a1.getMap());

        assertTrue(a1.getOffsets().isEmpty());
    }
}


text:
.speed-controls {
	position: absolute;
	bottom: 20px;
	left: 20px;
}


text:
package com.bv.eidss.web;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

import org.json.JSONException;
import org.json.JSONObject;

import com.bv.eidss.model.HumanCase;

public class HumanCaseInfoIn {

    public String lang;

    public Long id;
    public String offlineCaseID;
    public String caseID;
    public String localIdentifier;
    public Long tentativeDiagnosis;
    public Date tentativeDiagnosisDate;
    public String firstName;
    public String lastName;
    public Date dateOfBirth;
    public Integer patientAge;
    public Long patientAgeType;
    public Long patientGender;
    public Long country;
    public Long region;
    public Long rayon;
    public Long settlement;
    public String building;
    public String house;
    public String apartment;
    public String street;
    public String zipCode;
    public String homePhone;
    public Date onsetDate;
    public Long patientState;
    public Long hospitalization;

    public HumanCaseInfoIn(){}

    public HumanCaseInfoIn(HumanCase hc, String lng, long cntry){
        lang = lng;
		id = hc.getCase();
		caseID = hc.getCaseID();
		offlineCaseID = hc.getOfflineCaseID();
		localIdentifier = hc.getLocalIdentifier();
        tentativeDiagnosis = hc.getTentativeDiagnosis();
        tentativeDiagnosisDate = hc.getTentativeDiagnosisDate();
        firstName = hc.getFirstName();
        lastName = hc.getFamilyName();
        dateOfBirth = hc.getDateofBirth();
        patientAge = hc.getPatientAge();
        patientAgeType = hc.getHumanAgeType();
        patientGender = hc.getHumanGender();
        country = cntry;
        region = hc.getRegionCurrentResidence();
        rayon = hc.getRayonCurrentResidence();
        settlement = hc.getSettlementCurrentResidence();
        building = hc.getBuilding();
        house = hc.getHouse();
        apartment = hc.getApartment();
        street = hc.getStreetName();
        zipCode = hc.getPostCode();
        homePhone = hc.getHomePhone();
        onsetDate = hc.getOnSetDate();
        patientState = hc.getFinalState();
        hospitalization = hc.getHospitalizationStatus();
    }

    public JSONObject json() throws JSONException{
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.US);
    	JSONObject ret = new JSONObject();
    	ret.put("lang", lang);
    	ret.put("id", id);
    	ret.put("offlineCaseID", offlineCaseID);
    	ret.put("caseID", caseID);
    	if (localIdentifier != null)
    		ret.put("localIdentifier", localIdentifier);
    	if (tentativeDiagnosis != null)
        	ret.put("tentativeDiagnosis", tentativeDiagnosis.longValue());
    	if (tentativeDiagnosisDate != null)
        	ret.put("tentativeDiagnosisDate", format.format(tentativeDiagnosisDate).replace(' ', 'T'));
    	if (firstName != null)
    		ret.put("firstName", firstName);
    	if (lastName != null)
    		ret.put("lastName", lastName);
    	if (dateOfBirth != null)
        	ret.put("dateOfBirth", format.format(dateOfBirth));
    	if (patientAge != null)
        	ret.put("patientAge", patientAge.intValue());
    	if (patientAgeType != null)
        	ret.put("patientAgeType", patientAgeType.longValue());
    	if (patientGender != null)
        	ret.put("patientGender", patientGender.longValue());
    	if (country != null)
        	ret.put("country", country.longValue());
    	if (region != null)
        	ret.put("region", region.longValue());
    	if (rayon != null)
        	ret.put("rayon", rayon.longValue());
    	if (settlement != null)
        	ret.put("settlement", settlement.longValue());
    	if (building != null)
    		ret.put("building", building);
    	if (house != null)
    		ret.put("house", house);
    	if (apartment != null)
    		ret.put("apartment", apartment);
    	if (street != null)
    		ret.put("street", street);
    	if (zipCode != null)
    		ret.put("zipCode", zipCode);
    	if (homePhone != null)
    		ret.put("homePhone", homePhone);
    	if (onsetDate != null)
        	ret.put("onsetDate", format.format(onsetDate));
    	if (patientState != null)
        	ret.put("patientState", patientState.longValue());
    	if (hospitalization != null)
        	ret.put("hospitalization", hospitalization.longValue());
    	return ret;
    }
}