text:
#include <linux/module.h>
#include <linux/fd.h>
#include <linux/blkdev.h>
#include <linux/hdreg.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/platform_device.h>

#include <asm/macintosh.h>
#include <asm/mac_via.h>

#define CARDNAME "swim"

struct sector_header {
	unsigned char side;
	unsigned char track;
	unsigned char sector;
	unsigned char size;
	unsigned char crc0;
	unsigned char crc1;
} __attribute__((packed));

#define DRIVER_VERSION "Version 0.2 (2008-10-30)"

#define REG(x)	unsigned char x, x ## _pad[0x200 - 1];

struct swim {
	REG(write_data)
	REG(write_mark)
	REG(write_CRC)
	REG(write_parameter)
	REG(write_phase)
	REG(write_setup)
	REG(write_mode0)
	REG(write_mode1)

	REG(read_data)
	REG(read_mark)
	REG(read_error)
	REG(read_parameter)
	REG(read_phase)
	REG(read_setup)
	REG(read_status)
	REG(read_handshake)
} __attribute__((packed));

#define swim_write(base, reg, v) 	out_8(&(base)->write_##reg, (v))
#define swim_read(base, reg)		in_8(&(base)->read_##reg)

/* IWM registers */

struct iwm {
	REG(ph0L)
	REG(ph0H)
	REG(ph1L)
	REG(ph1H)
	REG(ph2L)
	REG(ph2H)
	REG(ph3L)
	REG(ph3H)
	REG(mtrOff)
	REG(mtrOn)
	REG(intDrive)
	REG(extDrive)
	REG(q6L)
	REG(q6H)
	REG(q7L)
	REG(q7H)
} __attribute__((packed));

#define iwm_write(base, reg, v) 	out_8(&(base)->reg, (v))
#define iwm_read(base, reg)		in_8(&(base)->reg)

/* bits in phase register */

#define SEEK_POSITIVE	0x070
#define SEEK_NEGATIVE	0x074
#define STEP		0x071
#define MOTOR_ON	0x072
#define MOTOR_OFF	0x076
#define INDEX		0x073
#define EJECT		0x077
#define SETMFM		0x171
#define SETGCR		0x175

#define RELAX		0x033
#define LSTRB		0x008

#define CA_MASK		0x077

/* Select values for swim_select and swim_readbit */

#define READ_DATA_0	0x074
#define TWOMEG_DRIVE	0x075
#define SINGLE_SIDED	0x076
#define DRIVE_PRESENT	0x077
#define DISK_IN		0x170
#define WRITE_PROT	0x171
#define TRACK_ZERO	0x172
#define TACHO		0x173
#define READ_DATA_1	0x174
#define MFM_MODE	0x175
#define SEEK_COMPLETE	0x176
#define ONEMEG_MEDIA	0x177

/* Bits in handshake register */

#define MARK_BYTE	0x01
#define CRC_ZERO	0x02
#define RDDATA		0x04
#define SENSE		0x08
#define MOTEN		0x10
#define ERROR		0x20
#define DAT2BYTE	0x40
#define DAT1BYTE	0x80

/* bits in setup register */

#define S_INV_WDATA	0x01
#define S_3_5_SELECT	0x02
#define S_GCR		0x04
#define S_FCLK_DIV2	0x08
#define S_ERROR_CORR	0x10
#define S_IBM_DRIVE	0x20
#define S_GCR_WRITE	0x40
#define S_TIMEOUT	0x80

/* bits in mode register */

#define CLFIFO		0x01
#define ENBL1		0x02
#define ENBL2		0x04
#define ACTION		0x08
#define WRITE_MODE	0x10
#define HEDSEL		0x20
#define MOTON		0x80

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

enum drive_location {
	INTERNAL_DRIVE = 0x02,
	EXTERNAL_DRIVE = 0x04,
};

enum media_type {
	DD_MEDIA,
	HD_MEDIA,
};

struct floppy_state {

	/* physical properties */

	enum drive_location location;	/* internal or external drive */
	int		 head_number;	/* single- or double-sided drive */

	/* media */

	int		 disk_in;
	int		 ejected;
	enum media_type	 type;
	int		 write_protected;

	int		 total_secs;
	int		 secpercyl;
	int		 secpertrack;

	/* in-use information */

	int		track;
	int		ref_count;

	struct gendisk *disk;

	/* parent controller */

	struct swim_priv *swd;
};

enum motor_action {
	OFF,
	ON,
};

enum head {
	LOWER_HEAD = 0,
	UPPER_HEAD = 1,
};

#define FD_MAX_UNIT	2

struct swim_priv {
	struct swim __iomem *base;
	spinlock_t lock;
	struct request_queue *queue;
	int floppy_count;
	struct floppy_state unit[FD_MAX_UNIT];
};

extern int swim_read_sector_header(struct swim __iomem *base,
				   struct sector_header *header);
extern int swim_read_sector_data(struct swim __iomem *base,
				 unsigned char *data);

static inline void set_swim_mode(struct swim __iomem *base, int enable)
{
	struct iwm __iomem *iwm_base;
	unsigned long flags;

	if (!enable) {
		swim_write(base, mode0, 0xf8);
		return;
	}

	iwm_base = (struct iwm __iomem *)base;
	local_irq_save(flags);

	iwm_read(iwm_base, q7L);
	iwm_read(iwm_base, mtrOff);
	iwm_read(iwm_base, q6H);

	iwm_write(iwm_base, q7H, 0x57);
	iwm_write(iwm_base, q7H, 0x17);
	iwm_write(iwm_base, q7H, 0x57);
	iwm_write(iwm_base, q7H, 0x57);

	local_irq_restore(flags);
}

static inline int get_swim_mode(struct swim __iomem *base)
{
	unsigned long flags;

	local_irq_save(flags);

	swim_write(base, phase, 0xf5);
	if (swim_read(base, phase) != 0xf5)
		goto is_iwm;
	swim_write(base, phase, 0xf6);
	if (swim_read(base, phase) != 0xf6)
		goto is_iwm;
	swim_write(base, phase, 0xf7);
	if (swim_read(base, phase) != 0xf7)
		goto is_iwm;
	local_irq_restore(flags);
	return 1;
is_iwm:
	local_irq_restore(flags);
	return 0;
}

static inline void swim_select(struct swim __iomem *base, int sel)
{
	swim_write(base, phase, RELAX);

	via1_set_head(sel & 0x100);

	swim_write(base, phase, sel & CA_MASK);
}

static inline void swim_action(struct swim __iomem *base, int action)
{
	unsigned long flags;

	local_irq_save(flags);

	swim_select(base, action);
	udelay(1);
	swim_write(base, phase, (LSTRB<<4) | LSTRB);
	udelay(1);
	swim_write(base, phase, (LSTRB<<4) | ((~LSTRB) & 0x0F));
	udelay(1);

	local_irq_restore(flags);
}

static inline int swim_readbit(struct swim __iomem *base, int bit)
{
	int stat;

	swim_select(base, bit);

	udelay(10);

	stat = swim_read(base, handshake);

	return (stat & SENSE) == 0;
}

static inline void swim_drive(struct swim __iomem *base,
			      enum drive_location location)
{
	if (location == INTERNAL_DRIVE) {
		swim_write(base, mode0, EXTERNAL_DRIVE); /* clear drive 1 bit */
		swim_write(base, mode1, INTERNAL_DRIVE); /* set drive 0 bit */
	} else if (location == EXTERNAL_DRIVE) {
		swim_write(base, mode0, INTERNAL_DRIVE); /* clear drive 0 bit */
		swim_write(base, mode1, EXTERNAL_DRIVE); /* set drive 1 bit */
	}
}

static inline void swim_motor(struct swim __iomem *base,
			      enum motor_action action)
{
	if (action == ON) {
		int i;

		swim_action(base, MOTOR_ON);

		for (i = 0; i < 2*HZ; i++) {
			swim_select(base, RELAX);
			if (swim_readbit(base, MOTOR_ON))
				break;
			current->state = TASK_INTERRUPTIBLE;
			schedule_timeout(1);
		}
	} else if (action == OFF) {
		swim_action(base, MOTOR_OFF);
		swim_select(base, RELAX);
	}
}

static inline void swim_eject(struct swim __iomem *base)
{
	int i;

	swim_action(base, EJECT);

	for (i = 0; i < 2*HZ; i++) {
		swim_select(base, RELAX);
		if (!swim_readbit(base, DISK_IN))
			break;
		current->state = TASK_INTERRUPTIBLE;
		schedule_timeout(1);
	}
	swim_select(base, RELAX);
}

static inline void swim_head(struct swim __iomem *base, enum head head)
{
	/* wait drive is ready */

	if (head == UPPER_HEAD)
		swim_select(base, READ_DATA_1);
	else if (head == LOWER_HEAD)
		swim_select(base, READ_DATA_0);
}

static inline int swim_step(struct swim __iomem *base)
{
	int wait;

	swim_action(base, STEP);

	for (wait = 0; wait < HZ; wait++) {

		current->state = TASK_INTERRUPTIBLE;
		schedule_timeout(1);

		swim_select(base, RELAX);
		if (!swim_readbit(base, STEP))
			return 0;
	}
	return -1;
}

static inline int swim_track00(struct swim __iomem *base)
{
	int try;

	swim_action(base, SEEK_NEGATIVE);

	for (try = 0; try < 100; try++) {

		swim_select(base, RELAX);
		if (swim_readbit(base, TRACK_ZERO))
			break;

		if (swim_step(base))
			return -1;
	}

	if (swim_readbit(base, TRACK_ZERO))
		return 0;

	return -1;
}

static inline int swim_seek(struct swim __iomem *base, int step)
{
	if (step == 0)
		return 0;

	if (step < 0) {
		swim_action(base, SEEK_NEGATIVE);
		step = -step;
	} else
		swim_action(base, SEEK_POSITIVE);

	for ( ; step > 0; step--) {
		if (swim_step(base))
			return -1;
	}

	return 0;
}

static inline int swim_track(struct floppy_state *fs,  int track)
{
	struct swim __iomem *base = fs->swd->base;
	int ret;

	ret = swim_seek(base, track - fs->track);

	if (ret == 0)
		fs->track = track;
	else {
		swim_track00(base);
		fs->track = 0;
	}

	return ret;
}

static int floppy_eject(struct floppy_state *fs)
{
	struct swim __iomem *base = fs->swd->base;

	swim_drive(base, fs->location);
	swim_motor(base, OFF);
	swim_eject(base);

	fs->disk_in = 0;
	fs->ejected = 1;

	return 0;
}

static inline int swim_read_sector(struct floppy_state *fs,
				   int side, int track,
				   int sector, unsigned char *buffer)
{
	struct swim __iomem *base = fs->swd->base;
	unsigned long flags;
	struct sector_header header;
	int ret = -1;
	short i;

	swim_track(fs, track);

	swim_write(base, mode1, MOTON);
	swim_head(base, side);
	swim_write(base, mode0, side);

	local_irq_save(flags);
	for (i = 0; i < 36; i++) {
		ret = swim_read_sector_header(base, &header);
		if (!ret && (header.sector == sector)) {
			/* found */

			ret = swim_read_sector_data(base, buffer);
			break;
		}
	}
	local_irq_restore(flags);

	swim_write(base, mode0, MOTON);

	if ((header.side != side)  || (header.track != track) ||
	     (header.sector != sector))
		return 0;

	return ret;
}

static int floppy_read_sectors(struct floppy_state *fs,
			       int req_sector, int sectors_nb,
			       unsigned char *buffer)
{
	struct swim __iomem *base = fs->swd->base;
	int ret;
	int side, track, sector;
	int i, try;

	swim_drive(base, fs->location);
	for (i = req_sector; i < req_sector + sectors_nb; i++) {
		int x;
		track = i / fs->secpercyl;
		x = i % fs->secpercyl;
		side = x / fs->secpertrack;
		sector = x % fs->secpertrack + 1;

		try = 5;
		do {
			ret = swim_read_sector(fs, side, track, sector,
						buffer);
			if (try-- == 0)
				return -EIO;
		} while (ret != 512);

		buffer += ret;
	}

	return 0;
}

static void redo_fd_request(struct request_queue *q)
{
	struct request *req;
	struct floppy_state *fs;

	req = blk_fetch_request(q);
	while (req) {
		int err = -EIO;

		fs = req->rq_disk->private_data;
		if (blk_rq_pos(req) >= fs->total_secs)
			goto done;
		if (!fs->disk_in)
			goto done;
		if (rq_data_dir(req) == WRITE && fs->write_protected)
			goto done;

		switch (rq_data_dir(req)) {
		case WRITE:
			/* NOT IMPLEMENTED */
			break;
		case READ:
			err = floppy_read_sectors(fs, blk_rq_pos(req),
						  blk_rq_cur_sectors(req),
						  req->buffer);
			break;
		}
	done:
		if (!__blk_end_request_cur(req, err))
			req = blk_fetch_request(q);
	}
}

static void do_fd_request(struct request_queue *q)
{
	redo_fd_request(q);
}

static struct floppy_struct floppy_type[4] = {
	{    0,  0, 0,  0, 0, 0x00, 0x00, 0x00, 0x00, NULL }, /* no testing   */
	{  720,  9, 1, 80, 0, 0x2A, 0x02, 0xDF, 0x50, NULL }, /* 360KB SS 3.5"*/
	{ 1440,  9, 2, 80, 0, 0x2A, 0x02, 0xDF, 0x50, NULL }, /* 720KB 3.5"   */
	{ 2880, 18, 2, 80, 0, 0x1B, 0x00, 0xCF, 0x6C, NULL }, /* 1.44MB 3.5"  */
};

static int get_floppy_geometry(struct floppy_state *fs, int type,
			       struct floppy_struct **g)
{
	if (type >= ARRAY_SIZE(floppy_type))
		return -EINVAL;

	if (type)
		*g = &floppy_type[type];
	else if (fs->type == HD_MEDIA) /* High-Density media */
		*g = &floppy_type[3];
	else if (fs->head_number == 2) /* double-sided */
		*g = &floppy_type[2];
	else
		*g = &floppy_type[1];

	return 0;
}

static void setup_medium(struct floppy_state *fs)
{
	struct swim __iomem *base = fs->swd->base;

	if (swim_readbit(base, DISK_IN)) {
		struct floppy_struct *g;
		fs->disk_in = 1;
		fs->write_protected = swim_readbit(base, WRITE_PROT);
		fs->type = swim_readbit(base, ONEMEG_MEDIA);

		if (swim_track00(base))
			printk(KERN_ERR
				"SWIM: cannot move floppy head to track 0\n");

		swim_track00(base);

		get_floppy_geometry(fs, 0, &g);
		fs->total_secs = g->size;
		fs->secpercyl = g->head * g->sect;
		fs->secpertrack = g->sect;
		fs->track = 0;
	} else {
		fs->disk_in = 0;
	}
}

static int floppy_open(struct block_device *bdev, fmode_t mode)
{
	struct floppy_state *fs = bdev->bd_disk->private_data;
	struct swim __iomem *base = fs->swd->base;
	int err;

	if (fs->ref_count == -1 || (fs->ref_count && mode & FMODE_EXCL))
		return -EBUSY;

	if (mode & FMODE_EXCL)
		fs->ref_count = -1;
	else
		fs->ref_count++;

	swim_write(base, setup, S_IBM_DRIVE  | S_FCLK_DIV2);
	udelay(10);
	swim_drive(base, INTERNAL_DRIVE);
	swim_motor(base, ON);
	swim_action(base, SETMFM);
	if (fs->ejected)
		setup_medium(fs);
	if (!fs->disk_in) {
		err = -ENXIO;
		goto out;
	}

	if (mode & FMODE_NDELAY)
		return 0;

	if (mode & (FMODE_READ|FMODE_WRITE)) {
		check_disk_change(bdev);
		if ((mode & FMODE_WRITE) && fs->write_protected) {
			err = -EROFS;
			goto out;
		}
	}
	return 0;
out:
	if (fs->ref_count < 0)
		fs->ref_count = 0;
	else if (fs->ref_count > 0)
		--fs->ref_count;

	if (fs->ref_count == 0)
		swim_motor(base, OFF);
	return err;
}

static int floppy_release(struct gendisk *disk, fmode_t mode)
{
	struct floppy_state *fs = disk->private_data;
	struct swim __iomem *base = fs->swd->base;

	if (fs->ref_count < 0)
		fs->ref_count = 0;
	else if (fs->ref_count > 0)
		--fs->ref_count;

	if (fs->ref_count == 0)
		swim_motor(base, OFF);

	return 0;
}

static int floppy_ioctl(struct block_device *bdev, fmode_t mode,
			unsigned int cmd, unsigned long param)
{
	struct floppy_state *fs = bdev->bd_disk->private_data;
	int err;

	if ((cmd & 0x80) && !capable(CAP_SYS_ADMIN))
			return -EPERM;

	switch (cmd) {
	case FDEJECT:
		if (fs->ref_count != 1)
			return -EBUSY;
		err = floppy_eject(fs);
		return err;

	case FDGETPRM:
		if (copy_to_user((void __user *) param, (void *) &floppy_type,
				 sizeof(struct floppy_struct)))
			return -EFAULT;
		break;

	default:
		printk(KERN_DEBUG "SWIM floppy_ioctl: unknown cmd %d\n",
		       cmd);
		return -ENOSYS;
	}
	return 0;
}

static int floppy_getgeo(struct block_device *bdev, struct hd_geometry *geo)
{
	struct floppy_state *fs = bdev->bd_disk->private_data;
	struct floppy_struct *g;
	int ret;

	ret = get_floppy_geometry(fs, 0, &g);
	if (ret)
		return ret;

	geo->heads = g->head;
	geo->sectors = g->sect;
	geo->cylinders = g->track;

	return 0;
}

static int floppy_check_change(struct gendisk *disk)
{
	struct floppy_state *fs = disk->private_data;

	return fs->ejected;
}

static int floppy_revalidate(struct gendisk *disk)
{
	struct floppy_state *fs = disk->private_data;
	struct swim __iomem *base = fs->swd->base;

	swim_drive(base, fs->location);

	if (fs->ejected)
		setup_medium(fs);

	if (!fs->disk_in)
		swim_motor(base, OFF);
	else
		fs->ejected = 0;

	return !fs->disk_in;
}

static const struct block_device_operations floppy_fops = {
	.owner		 = THIS_MODULE,
	.open		 = floppy_open,
	.release	 = floppy_release,
	.locked_ioctl	 = floppy_ioctl,
	.getgeo		 = floppy_getgeo,
	.media_changed	 = floppy_check_change,
	.revalidate_disk = floppy_revalidate,
};

static struct kobject *floppy_find(dev_t dev, int *part, void *data)
{
	struct swim_priv *swd = data;
	int drive = (*part & 3);

	if (drive > swd->floppy_count)
		return NULL;

	*part = 0;
	return get_disk(swd->unit[drive].disk);
}

static int __devinit swim_add_floppy(struct swim_priv *swd,
				     enum drive_location location)
{
	struct floppy_state *fs = &swd->unit[swd->floppy_count];
	struct swim __iomem *base = swd->base;

	fs->location = location;

	swim_drive(base, location);

	swim_motor(base, OFF);

	if (swim_readbit(base, SINGLE_SIDED))
		fs->head_number = 1;
	else
		fs->head_number = 2;
	fs->ref_count = 0;
	fs->ejected = 1;

	swd->floppy_count++;

	return 0;
}

static int __devinit swim_floppy_init(struct swim_priv *swd)
{
	int err;
	int drive;
	struct swim __iomem *base = swd->base;

	/* scan floppy drives */

	swim_drive(base, INTERNAL_DRIVE);
	if (swim_readbit(base, DRIVE_PRESENT))
		swim_add_floppy(swd, INTERNAL_DRIVE);
	swim_drive(base, EXTERNAL_DRIVE);
	if (swim_readbit(base, DRIVE_PRESENT))
		swim_add_floppy(swd, EXTERNAL_DRIVE);

	/* register floppy drives */

	err = register_blkdev(FLOPPY_MAJOR, "fd");
	if (err) {
		printk(KERN_ERR "Unable to get major %d for SWIM floppy\n",
		       FLOPPY_MAJOR);
		return -EBUSY;
	}

	for (drive = 0; drive < swd->floppy_count; drive++) {
		swd->unit[drive].disk = alloc_disk(1);
		if (swd->unit[drive].disk == NULL) {
			err = -ENOMEM;
			goto exit_put_disks;
		}
		swd->unit[drive].swd = swd;
	}

	swd->queue = blk_init_queue(do_fd_request, &swd->lock);
	if (!swd->queue) {
		err = -ENOMEM;
		goto exit_put_disks;
	}

	for (drive = 0; drive < swd->floppy_count; drive++) {
		swd->unit[drive].disk->flags = GENHD_FL_REMOVABLE;
		swd->unit[drive].disk->major = FLOPPY_MAJOR;
		swd->unit[drive].disk->first_minor = drive;
		sprintf(swd->unit[drive].disk->disk_name, "fd%d", drive);
		swd->unit[drive].disk->fops = &floppy_fops;
		swd->unit[drive].disk->private_data = &swd->unit[drive];
		swd->unit[drive].disk->queue = swd->queue;
		set_capacity(swd->unit[drive].disk, 2880);
		add_disk(swd->unit[drive].disk);
	}

	blk_register_region(MKDEV(FLOPPY_MAJOR, 0), 256, THIS_MODULE,
			    floppy_find, NULL, swd);

	return 0;

exit_put_disks:
	unregister_blkdev(FLOPPY_MAJOR, "fd");
	while (drive--)
		put_disk(swd->unit[drive].disk);
	return err;
}

static int __devinit swim_probe(struct platform_device *dev)
{
	struct resource *res;
	struct swim __iomem *swim_base;
	struct swim_priv *swd;
	int ret;

	res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
	if (!res) {
		ret = -ENODEV;
		goto out;
	}

	if (!request_mem_region(res->start, resource_size(res), CARDNAME)) {
		ret = -EBUSY;
		goto out;
	}

	swim_base = ioremap(res->start, resource_size(res));
	if (!swim_base) {
		return -ENOMEM;
		goto out_release_io;
	}

	/* probe device */

	set_swim_mode(swim_base, 1);
	if (!get_swim_mode(swim_base)) {
		printk(KERN_INFO "SWIM device not found !\n");
		ret = -ENODEV;
		goto out_iounmap;
	}

	/* set platform driver data */

	swd = kzalloc(sizeof(struct swim_priv), GFP_KERNEL);
	if (!swd) {
		ret = -ENOMEM;
		goto out_iounmap;
	}
	platform_set_drvdata(dev, swd);

	swd->base = swim_base;

	ret = swim_floppy_init(swd);
	if (ret)
		goto out_kfree;

	return 0;

out_kfree:
	platform_set_drvdata(dev, NULL);
	kfree(swd);
out_iounmap:
	iounmap(swim_base);
out_release_io:
	release_mem_region(res->start, resource_size(res));
out:
	return ret;
}

static int __devexit swim_remove(struct platform_device *dev)
{
	struct swim_priv *swd = platform_get_drvdata(dev);
	int drive;
	struct resource *res;

	blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);

	for (drive = 0; drive < swd->floppy_count; drive++) {
		del_gendisk(swd->unit[drive].disk);
		put_disk(swd->unit[drive].disk);
	}

	unregister_blkdev(FLOPPY_MAJOR, "fd");

	blk_cleanup_queue(swd->queue);

	/* eject floppies */

	for (drive = 0; drive < swd->floppy_count; drive++)
		floppy_eject(&swd->unit[drive]);

	iounmap(swd->base);

	res = platform_get_resource_byname(dev, IORESOURCE_MEM, "swim-regs");
	if (res)
		release_mem_region(res->start, resource_size(res));

	platform_set_drvdata(dev, NULL);
	kfree(swd);

	return 0;
}

static struct platform_driver swim_driver = {
	.probe  = swim_probe,
	.remove = __devexit_p(swim_remove),
	.driver   = {
		.name	= CARDNAME,
		.owner	= THIS_MODULE,
	},
};

static int __init swim_init(void)
{
	printk(KERN_INFO "SWIM floppy driver %s\n", DRIVER_VERSION);

	return platform_driver_register(&swim_driver);
}
module_init(swim_init);

static void __exit swim_exit(void)
{
	platform_driver_unregister(&swim_driver);
}
module_exit(swim_exit);

MODULE_DESCRIPTION("Driver for SWIM floppy controller");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Laurent Vivier <laurent@lvivier.info>");
MODULE_ALIAS_BLOCKDEV_MAJOR(FLOPPY_MAJOR);


text:
// Copyright Skia Inc. 2004 - 2005
//
#include "SkXMLParser.h"

bool SkXMLParser::parse(SkStream& docStream)
{
    return false;
}

bool SkXMLParser::parse(const char doc[], size_t len)
{
    return false;
}

void SkXMLParser::GetNativeErrorString(int error, SkString* str)
{

}

redpajama_set_name: RedPajamaGithub


text:
package io.intercom.api;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Maps;

import java.util.Map;

@SuppressWarnings("UnusedDeclaration")
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonIgnoreProperties(ignoreUnknown = true)
class CompanyWithStringPlan extends TypedData {

    @JsonProperty("id")
    private String id;

    @JsonProperty("name")
    private String name;

    @JsonProperty("company_id")
    private String companyID;

    @JsonProperty("session_count")
    private int sessionCount;

    @JsonProperty("monthly_spend")
    private float monthlySpend;

    @JsonProperty("remote_created_at")
    private long remoteCreatedAt;

    @JsonProperty("plan")
    private String plan;

    @JsonProperty("size")
    private int size;

    @JsonProperty("website")
    private String website;

    @JsonProperty("industry")
    private String industry;

    @JsonIgnoreProperties(ignoreUnknown = false)
    @JsonProperty("custom_attributes")
    private Map<String, CustomAttribute> customAttributes = Maps.newHashMap();

    @JsonProperty("remove")
    @JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean remove;

    public CompanyWithStringPlan() {
    }

    public String getType() {
        return "company";
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCompanyID() {
        return companyID;
    }

    public void setCompanyID(String companyID) {
        this.companyID = companyID;
    }

    public Integer getSessionCount() {
        return sessionCount;
    }

    public void setSessionCount(Integer sessionCount) {
        this.sessionCount = sessionCount;
    }

    public float getMonthlySpend() {
        return monthlySpend;
    }

    public void setMonthlySpend(float monthlySpend) {
        this.monthlySpend = monthlySpend;
    }

    public long getRemoteCreatedAt() {
        return remoteCreatedAt;
    }

    public void setRemoteCreatedAt(long remoteCreatedAt) {
        this.remoteCreatedAt = remoteCreatedAt;
    }

    public int getSize() {
        return size;
    }

    public void setSize(int size) {
        this.size = size;
    }

    public String getWebsite() {
        return website;
    }

    public void setWebsite(String website) {
        this.website = website;
    }

    public String getIndustry() {
        return industry;
    }

    public void setIndustry(String industry) {
        this.industry = industry;
    }

    public String getPlan() {
        return plan;
    }

    public void setPlan(String plan) {
        this.plan = plan;
    }

    public Map<String, CustomAttribute> getCustomAttributes() {
        return customAttributes;
    }

    public void setCustomAttributes(Map<String, CustomAttribute> customAttributes) {
        this.customAttributes = customAttributes;
    }

    public Boolean getRemove() {
        return remove;
    }

    public CompanyWithStringPlan setRemove(Boolean remove) {
        this.remove = remove;
        return this;
    }
}


text:
package gov.nih.nci.ess.safetyreporting.rules.common;

import java.rmi.RemoteException;

/**
 * This class is autogenerated, DO NOT EDIT.
 *
 * This interface represents the API which is accessable on the grid service from the client.
 *
 * @created by Introduce Toolkit version 1.3
 *
 */
public interface SafetyReportRulesManagementI {

  public org.oasis.wsrf.lifetime.DestroyResponse destroy(org.oasis.wsrf.lifetime.Destroy params) throws RemoteException ;

  public org.oasis.wsrf.lifetime.SetTerminationTimeResponse setTerminationTime(org.oasis.wsrf.lifetime.SetTerminationTime params) throws RemoteException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule createOrganizationSafetyReportingRules(gov.nih.nci.ess.safetyreporting.types.ReportingRule reportingRule,ess.caaers.nci.nih.gov.Id organizationId) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule updateOrganizationSafetyReportingRules(gov.nih.nci.ess.safetyreporting.types.ReportingRule reportingRule,ess.caaers.nci.nih.gov.Id organizationId) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule deactivateOrganizationSafetyReportingRules(ess.caaers.nci.nih.gov.Id organizationId,_21090.org.iso.ST reasonForDeactivation) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule createStudySafetyReportingRules(gov.nih.nci.ess.safetyreporting.types.ReportingRule reportingRule,ess.caaers.nci.nih.gov.Id studyId,ess.caaers.nci.nih.gov.Id organizationId) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule updateStudySafetyReportingRules(gov.nih.nci.ess.safetyreporting.types.ReportingRule reportingRule,ess.caaers.nci.nih.gov.Id studyId,ess.caaers.nci.nih.gov.Id organizationId) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule deactivateStudySafetyReportingRules(ess.caaers.nci.nih.gov.Id studyId,ess.caaers.nci.nih.gov.Id organizationId,_21090.org.iso.ST reasonForDeactivation) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.DSET_ReportingRule querySafetyReportingRules(gov.nih.nci.ess.safetyreporting.types.ReportingRule reportingRule) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

  public gov.nih.nci.ess.safetyreporting.types.ReportingRule getSafetyReportingRules(ess.caaers.nci.nih.gov.Id ruleId) throws RemoteException, gov.nih.nci.ess.safetyreporting.management.stubs.types.SafetyReportingServiceException ;

}


text:
"use strict";
/*
  License: see license.txt
  Originally from http://blog.olkie.com/2013/11/05/online-c-function-prototype-header-generator-tool/
*/
Object.defineProperty(exports, "__esModule", { value: true });
var FoundFunction_1 = require("./FoundFunction");
var CParser = /** @class */ (function () {
    function CParser() {
    }
    CParser.parseFuncProtos = function (inputCode, parseComments) {
        var functions = [];
        var cKeywords = ["auto", "break", "case", "char", "const", "continue", "default", "do", "double", "else", "enum", "extern", "float", "for", "goto", "if", "int", "long", "register", "return", "short", "signed", "sizeof", "static", "struct", "switch", "typedef", "union", "unsigned", "void", "volatile", "while"];
        var invalidFunctionNames = cKeywords;
        var invalidReturnTypes = ["auto", "break", "case", "continue", "default", "do", "else", "for", "goto", "if", "return", "sizeof", "switch", "while", "typedef"]; //TODO: may have some of these wrong
        //convert all line endings to a \n
        inputCode = inputCode.replace(/\r\n|\r/, "\n");
        //grab all comment blocks, and comment lines preceeding function definition
        var reStringPart = /"(?:\\[\n|.]|[^\n\\])"/.source;
        var reCommentPart = /\/(?:[*][\s\S]*?(?:[*]\/|$)|\/.*(?=\n|$))/.source; //NOTE the look ahead! can't capture \n, because js doesn't support \Z and we need our big re pattern below to be able to match on \Z or $ if not using multiline mode
        var reStringOrCommentOrAny = "(?:" + reCommentPart + "|" + reStringPart + "|[\\s\\S])*?"; //tries to respect comments and strings
        //var reBeforePart = /([\s\S]*?)/.source; //does not respect comments or strings
        var reBeforePart = "(" + reStringOrCommentOrAny + ")";
        var reDoxygenCommentsPart = /\s*((?:\s*\/[*][*!][\s\S]*?[*]\/|\s*\/\/[\/!].*(?:\n|$))+)/.source;
        var re = new RegExp(reBeforePart + /(?:(?:^|\n)\s*(\w+[\s*\t\w]+)\b\s*(\w+)\s*\(\s*([^)]*)\s*\)\s*([{;])|$)/.source, "g"); //can't use multiline mode because we need to match on end of input, not just line
        //console.log(re);
        var groups;
        var lastIndex = -1; //detect stuck in loops
        while ((groups = re.exec(inputCode)) !== null && groups.index != lastIndex) {
            var result = new FoundFunction_1.FoundFunction();
            result.before = (groups[1] || "").trim();
            result.returnType = (groups[2] || "").replace(/\s+/g, " ").trim();
            result.functionName = (groups[3] || "").trim();
            result.parameters = (groups[4] || "").replace(/\s+/g, " ").trim();
            if (groups[5] == ";") {
                result.declared = true;
            }
            //if we didn't find a function name, don't add it or invalid keywords used
            if (result.functionName) {
                //check individual return type words
                var returnTypes = result.returnType.toLowerCase().split(/[\s*]+/);
                if (arraysIntersect(returnTypes, invalidReturnTypes) || invalidFunctionNames.indexOf(result.functionName.toLowerCase()) != -1) {
                    //TODO: log use of invalid keyword (or rather that we thought we found a function declaration/definition, but it had invalid keywords).
                }
                else {
                    //extract comments, if any
                    if (parseComments === true) {
                        var reComments = new RegExp(reBeforePart + reDoxygenCommentsPart + /\s*/.source, "g");
                        //have to loop and find last match and check if it matches right up to end of .before value. Why loop? because if we tell it to match up to $ (if it can), it will create some problems. /** header */ other lines (not a function) /* comment */ function. It will match right on over. Need to let it stop once it is happy and not force to end of input.
                        var groups2;
                        var madeItToEnd = false;
                        while (!madeItToEnd && (groups2 = reComments.exec(result.before)) !== null) {
                            madeItToEnd = reComments.lastIndex == result.before.length;
                        }
                        //if we made it to the end of the input string, then we found a matching doxygen comment!!!
                        if (madeItToEnd && groups2) {
                            result.before = groups2[1];
                            result.comments = groups2[2].replace(/(\r\n|\r|\n)[ \t]+/g, "$1"); //remove indenting
                        }
                    }
                    functions.push(result);
                } //end of invalid keywords test
            }
            lastIndex = groups.index;
        }
        return functions;
    };
    return CParser;
}());
exports.CParser = CParser;
function arraysIntersect(array1, array2) {
    var result = false;
    for (var i = 0; !result && i < array2.length; i++) {
        result = array1.indexOf(array2[i]) !== -1;
    }
    return result;
}
//# sourceMappingURL=CParser.js.map


text:
"""
Cross-validation iterators for GAM

Author: Luca Puggini

"""

from __future__ import division

from abc import ABCMeta, abstractmethod
from statsmodels.compat.python import with_metaclass
import numpy as np

class BaseCrossValidator(with_metaclass(ABCMeta)):
    """
    The BaseCrossValidator class is a base class for all the iterators that
    split the data in train and test as for example KFolds or LeavePOut
    """
    def __init__(self):
        pass

    @abstractmethod
    def split(self):
        pass

class KFold(BaseCrossValidator):
    """
    K-Folds cross validation iterator:
    Provides train/test indexes to split data in train test sets

    Parameters
    ----------
    k: int
        number of folds
    shuffle : bool
        If true, then the index is shuffled before splitting into train and
        test indices.

    Notes
    -----
    All folds except for last fold have size trunc(n/k), the last fold has
    the remainder.
    """

    def __init__(self, k_folds, shuffle=False):
        self.nobs = None
        self.k_folds = k_folds
        self.shuffle = shuffle

    def split(self, X, y=None, label=None):
        """yield index split into train and test sets
        """
        # TODO: X and y are redundant, we only need nobs

        nobs = X.shape[0]
        index = np.array(range(nobs))

        if self.shuffle:
            np.random.shuffle(index)

        folds = np.array_split(index, self.k_folds)
        for fold in folds:
            test_index = np.zeros(nobs, dtype=np.bool_)
            test_index[fold] = True
            train_index = np.logical_not(test_index)
            yield train_index, test_index


text:
title: Why It's So Good To Be a Christian
testament: Old
pastor: Jamie Mason
book: Psalm 16
audio: http://www.mecgoodnews.org/audio/190820182.mp3
service: Evening
---


text:
/**
* Tuner Source (Audio signal source)
*
* @typedef {Object} Tuner.Source
* @abstract
*/
Tuner.Source = function(tuner, opts)
{
	console.debug('Tuner.Source');
	var default_opts = {};

	this.options = extend(default_opts, opts);

	this.init(tuner);
};

Tuner.Source.prototype.init = function(tuner)
{
	console.debug('Tuner.Source::init');
	this.tuner = tuner;
};


text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <title>statsmodels.emplike.descriptive.DescStatUV — statsmodels v0.10.2 documentation</title>
    <link rel="stylesheet" href="../_static/nature.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
    <link rel="stylesheet" type="text/css" href="../_static/graphviz.css" />

    <link rel="shortcut icon" href="../_static/statsmodels_hybi_favico.ico"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="statsmodels.emplike.descriptive.DescStatUV.ci_kurt" href="statsmodels.emplike.descriptive.DescStatUV.ci_kurt.html" />
    <link rel="prev" title="statsmodels.emplike.descriptive.DescStat" href="statsmodels.emplike.descriptive.DescStat.html" />
<link rel="stylesheet" href="../_static/examples.css" type="text/css" />
<link rel="stylesheet" href="../_static/facebox.css" type="text/css" />

Navigation

          index

          modules |

          next |

          previous |

Install
  |

Support
  |

Bugs
  |

Develop
  |

Examples
  |

FAQ
  |

Empirical Likelihood emplike |

statsmodels.emplike.descriptive.DescStatUV¶

class statsmodels.emplike.descriptive.DescStatUV(endog)[source]¶

A class to compute confidence intervals and hypothesis tests involving
mean, variance, kurtosis and skewness of a univariate random variable.

Parameters

endog1darray

Data to be analyzed

Attributes

endog1darray

Data to be analyzed

nobsfloat

Number of observations

Methods

<colgroup>
<col style="width: 10%" />
<col style="width: 90%" />
</colgroup>

ci_kurt([sig, upper_bound, lower_bound])

Returns the confidence interval for kurtosis.

ci_mean([sig, method, epsilon, gamma_low, …])

Returns the confidence interval for the mean.

ci_skew([sig, upper_bound, lower_bound])

Returns the confidence interval for skewness.

ci_var([lower_bound, upper_bound, sig])

Returns the confidence interval for the variance.

plot_contour(mu_low, mu_high, var_low, …)

Returns a plot of the confidence region for a univariate mean and variance.

test_joint_skew_kurt(skew0, kurt0[, …])

Returns - 2 x log-likelihood and the p-value for the joint hypothesis test for skewness and kurtosis

test_kurt(kurt0[, return_weights])

Returns -2 x log-likelihood and the p-value for the hypothesized kurtosis.

test_mean(mu0[, return_weights])

Returns - 2 x log-likelihood ratio, p-value and weights for a hypothesis test of the mean.

test_skew(skew0[, return_weights])

Returns  -2 x log-likelihood and p-value for the hypothesized skewness.

test_var(sig2_0[, return_weights])

Returns  -2 x log-likelihoog ratio and the p-value for the hypothesized variance

Previous topic

statsmodels.emplike.descriptive.DescStat

Next topic

statsmodels.emplike.descriptive.DescStatUV.ci_kurt

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>

        © Copyright 2009-2018, Josef Perktold, Skipper Seabold, Jonathan Taylor, statsmodels-developers.
      Created using Sphinx 2.2.1.


text:
"use scrict";
// Remember to handle errors and validate functions
// 1. Create a function that takes an array of values and returns one randonly selected value from that array.
// find the length of the arry. select a random position in that array and return it.

// Create a way to get a random integer based on that arrays length
// var myArray = ['test', 'james', 'roger', 'mickey'];

// function getRandomInt(array) {
//   return Math.floor(Math.random() * (array.length - 0)) + 0;
// }

// function randomPosition(arrayName) {
// 	return getRandomInt(arrayName);
// }

//console.log(myArray);
//console.log(randomPosition(myArray));
//console.log(myArray[randomPosition(myArray)]);

//2. Create a function that takes an unencrypted string and returns the ROT-13 version of that string.
//This is slightly different but similar to the example we did in class.
// Take a string
// Break it into an array
// Move each array element +13 positions in ASCII, but +13 would take it out of the alphabet number range. stay within bounds of alaphebet ascii range.
//Join up all the elements back to a string
//Print that string

//Ascii values above 13 in the alphabet range will need to circle back to the start of that range to print an alphabet character
//Ascii 97-122 abcd..xyz
// Any letters above 'm' should start their ascii value back at the letter 'a' so they need to be converted as a string ahead of time

// Failed program below for #2. Fails Rr => E

// var myName = window.prompt('What do you want to encrypt?');
// if(myName.charCodeAt() < 123 && myName.charCodeAt() > 96) {

// 	var name = '';

// 	for(var i=0; i<myName.length; i++) {
// 		var asciiValue = myName.charCodeAt(i);
// 		if(asciiValue > 109 && asciiValue < 123) {
// 			asciiValue = (asciiValue + 13) -26;
// 			name+=String.fromCharCode(asciiValue);
// 		} else {
// 			asciiValue += 13;
// 			name+=String.fromCharCode(asciiValue);
// 		}
// 	}
// 	console.log(name);
// } else if(myName.charCodeAt() < 91 && myName.charCodeAt() > 64){

// 	// var name = '';

// 	for(var i=0; i<myName.length; i++) {
// 		var asciiValue = myName.charCodeAt(i);
// 		if(asciiValue > 77 && asciiValue < 91) {
// 			asciiValue = (asciiValue + 13) -26;
// 			name+=String.fromCharCode(asciiValue);
// 		} else {
// 			asciiValue += 13;
// 			name+=String.fromCharCode(asciiValue);
// 		}
// 	}
// 	console.log(name);

// } else  {
// 	window.alert("Please use the alphabet upper or lowercase.");
// 	throw("Not within Ascii characters of the alphabet.");
// }

// #2 Working program
// var myName = window.prompt('What do you want to encrypt?');
// // if((myName.charCodeAt() < 123 && myName.charCodeAt() > 96) || myName.charCodeAt() < 91 && myName.charCodeAt() > 64) {
// if(/[a-zA-Z]/.test(myName)) {
// 	var name = '';

// 	for(var i=0; i<myName.length; i++) {
// 		var asciiValue = myName.charCodeAt(i);
// 		if(asciiValue > 109 && asciiValue < 123) {
// 			asciiValue = (asciiValue + 13) -26;
// 			name+=String.fromCharCode(asciiValue);
// 		} else if(asciiValue > 96 && asciiValue < 109) {
// 			asciiValue += 13;
// 			name+=String.fromCharCode(asciiValue);
// 		} else if(asciiValue > 77 && asciiValue < 91) {
// 			asciiValue = (asciiValue + 13) -26;
// 			name+=String.fromCharCode(asciiValue);
// 		} else {
// 			asciiValue += 13;
// 			name+=String.fromCharCode(asciiValue);
// 		}
// 	}
// 	console.log(name);
// } else  {
// 	window.alert("Please use the alphabet upper or lowercase.");
// 	throw("Not within Ascii characters of the alphabet.");
// }

//3. Create a function that takes a ROT-13 encrypted string and returns the decrypted version of that string.
// var myName = window.prompt('What do you want to encrypt?');
// // if((myName.charCodeAt() < 123 && myName.charCodeAt() > 96) || myName.charCodeAt() < 91 && myName.charCodeAt() > 64) {
// if(/[a-zA-Z]/.test(myName)) {
// 	var name = '';

// 	for(var i=0; i<myName.length; i++) {
// 		var asciiValue = myName.charCodeAt(i);
// 		if(asciiValue > 109 && asciiValue < 123) {
// 			asciiValue -= 13;
// 			name+=String.fromCharCode(asciiValue);
// 		} else if(asciiValue > 96 && asciiValue > 109) {
// 			asciiValue = (asciiValue - 13) + 26;
// 			name+=String.fromCharCode(asciiValue);
// 		} else if(asciiValue > 77 && asciiValue < 91) {
// 			asciiValue -= 13;
// 			name+=String.fromCharCode(asciiValue);
// 		} else {
// 			asciiValue = (asciiValue - 13) + 26;
// 			name+=String.fromCharCode(asciiValue);
// 		}
// 	}
// 	console.log(name);
// } else  {
// 	window.alert("Please use the alphabet upper or lowercase.");
// 	throw("Not within Ascii characters of the alphabet.");
// }

// 4. Create a function that takes an unencrypted string and an integer (n) and returns the ROT-N version

// var myName = window.prompt('What do you want to encrypt?');
// var rotNum = window.prompt('What ROT-N would you like to us? Enter a number.');
// // if((myName.charCodeAt() < 123 && myName.charCodeAt() > 96) || myName.charCodeAt() < 91 && myName.charCodeAt() > 64) {
// if(/[a-zA-Z]/.test(myName)) {
// 	var name = '';

// 	for(var i=0; i<myName.length; i++) {
// 		var asciiValue = myName.charCodeAt(i);
// 		if(asciiValue >= 97 && asciiValue <= 122) {
// 				asciiValue = (asciiValue - 96);
// 				asciiValue = asciiValue + parseInt(rotNum);

// 				while(asciiValue > 26) {
// 					asciiValue = asciiValue - 26;
// 			}
// 				asciiValue = asciiValue + 96;
// 				name+=String.fromCharCode(asciiValue);
// 		} else if(asciiValue >= 65 && asciiValue <= 90) {
// 				asciiValue = (asciiValue - 64);
// 				asciiValue = asciiValue + parseInt(rotNum);

// 				while(asciiValue > 26) {
// 					asciiValue = asciiValue - 26;
// 				}
// 				asciiValue = asciiValue + 64;
// 				name+=String.fromCharCode(asciiValue);
// 		}
// 	}
// 	console.log(name);
// } else  {
// 	window.alert("Please use the alphabet upper or lowercase.");
// 	throw("Not within Ascii characters of the alphabet.");
// }

//5. Create a javascript function that takes an array of student names and returns an array of randomly selected pairs
// of students (array of arrays).

// var studentList = ["alex", "james", "rick", "gabe", "ryan", "traivs", "aaron", "erica"];
// var pairedList = [];

// function getRandomInt(array) {
//   return Math.floor(Math.random() * (array.length - 0)) + 0;
// }

// function randomPosition() {
// 	return getRandomInt(studentList);
// }

// for(i=0; i < studentList.length; i+2) {
// 		pair = [];
// 		pair += studentList.splice(randomPosition(), 1) + " ";
// 		pair += studentList.splice(randomPosition(), 1);

// 		pairedList.push(pair);
// }

// console.log(pairedList);

// 6. Create a function that takes a string and returns a string with a dash (-) in between each character
// using .split and .join.

var splitJoin = function(string) {
	return string.split('').join('-');
};

// 7. Create a function that takes a string and returns a string with a dash (-) in between each character
// without using .split or .join.

// var myString = "Alex";
// var newString = "";

// var sliceCounter = function(string) {
// 	for(i=0; i<string.length; i++) {
// 		newString += string.slice(i, i+1) + "-";
// 		console.log(newString);
// 	}
// };

// sliceCounter(myString);

// 8. Create a function that takes two string strings and returns a string with a dash (-) in between each
// character without using .split or .join.

// var myString1 = "Alex";
// var myString2 = "James";
// var newString = "";

// var sliceCounter = function(string1, string2) {
// 	for(i=0; i<string1.length; i++) {
// 		newString += string1.slice(i, i+1) + "-";
// 		console.log(newString);
// 	}
// 	for(i=0; i<string2.length; i++) {
// 		newString += string2.slice(i, i+1) + "-";
// 		console.log(newString);
// 	}
// };

// sliceCounter(myString1, myString2);

//9. Use $('selector').val() and $('selector').click() to re-create your number guessing game without using window.prompt.
// Use Bootstrap to build the page.

// $(document).ready(function() {

// 	$( "#numBox" )
//   .inputNum(function() {
//     value = $( this ).val();
//   })
//   .inputNum();
//   console.log(value);

//     $('#playButton').on('click', function() {
//         var $btn = $(this).button('loading');
//         console.log('Play button has been clicked');
//         // business logic...
//         $btn.button('reset');

//         // Random computer generated integer in a self-invoking function so it is always called at the start each time.
//         var randomComputerNumber = function() {
//             return Math.floor(Math.random() * (100 - 1) + 1);
//         }();

//         // User prompt to ask for integer and store it and display in console. Var aNumber is a number not a string.
//         var aNumber = Number(window.prompt("Enter a whole number between 1-100. If you guess right, you win!", ""));
//         var answer = true; //
//         console.log("User Number is " + aNumber);
//         console.log("Computer Number is " + randomComputerNumber);

//         // Validate number is an integer, if not then prompt user to pick again. Need to refine else statement
//         if (Math.floor(aNumber) === aNumber && aNumber > 0) {
//             if (aNumber === randomComputerNumber) {
//                 window.alert("You win!");
//                 anwser = false;
//             } else if (aNumber < randomComputerNumber) {
//                 // window.alert("You're too low.");
//                 aNumber = Number(window.prompt("You're too low.\nEnter a whole number between 1-100. If you guess right, you win!", ""));
//             } else if (aNumber > randomComputerNumber) {
//                 // window.alert("You're too high.");
//                 aNumber = Number(window.prompt("You're too high.\nEnter a whole number between 1-100. If you guess right, you win!", ""));
//             }
//         } else {
//             window.confirm("You must pick a whole number! Try again.");
//         }
//     });
// });


text:
using System;
using OPSIVRSystem.Utils;
using OPSSDK;
using Ozeki.VoIP;

namespace OPSIVRSystem
{
    public interface IIVREngine
    {
        void Start(string IVRProjectPath, IAPIExtension extension);

        void Stop();

        /// <summary>
        /// Logging request on GUI.
        /// </summary>
         event EventHandler<GenericEventArgs<string>> NotifyAction;
    }
}


text:
namespace sh
{

namespace
{

constexpr const ImmutableString kMainName("main");
constexpr const ImmutableString kImageLoadName("imageLoad");
constexpr const ImmutableString kImageStoreName("imageStore");
constexpr const ImmutableString kImageSizeName("imageSize");
constexpr const ImmutableString kImageAtomicExchangeName("imageAtomicExchange");
constexpr const ImmutableString kAtomicCounterName("atomicCounter");

static const char kFunctionMangledNameSeparator = '(';

}  // anonymous namespace

TSymbol::TSymbol(TSymbolTable *symbolTable,
                 const ImmutableString &name,
                 SymbolType symbolType,
                 SymbolClass symbolClass,
                 TExtension extension)
    : mName(name),
      mUniqueId(symbolTable->nextUniqueId()),
      mSymbolType(symbolType),
      mExtension(extension),
      mSymbolClass(symbolClass)
{
    ASSERT(mSymbolType == SymbolType::BuiltIn || mExtension == TExtension::UNDEFINED);
    ASSERT(mName != "" || mSymbolType == SymbolType::AngleInternal ||
           mSymbolType == SymbolType::Empty);
}

ImmutableString TSymbol::name() const
{
    if (!mName.empty())
    {
        return mName;
    }
    // This can be called for nameless function parameters in HLSL.
    ASSERT(mSymbolType == SymbolType::AngleInternal ||
           (mSymbolType == SymbolType::Empty && isVariable()));
    int uniqueId = mUniqueId.get();
    ImmutableStringBuilder symbolNameOut(sizeof(uniqueId) * 2u + 1u);
    symbolNameOut << 's';
    symbolNameOut.appendHex(mUniqueId.get());
    return symbolNameOut;
}

ImmutableString TSymbol::getMangledName() const
{
    if (mSymbolClass == SymbolClass::Function)
    {
        // We do this instead of using proper virtual functions so that we can better support
        // constexpr symbols.
        return static_cast<const TFunction *>(this)->getFunctionMangledName();
    }
    ASSERT(mSymbolType != SymbolType::Empty);
    return name();
}

TVariable::TVariable(TSymbolTable *symbolTable,
                     const ImmutableString &name,
                     const TType *type,
                     SymbolType symbolType,
                     TExtension extension)
    : TSymbol(symbolTable, name, symbolType, SymbolClass::Variable, extension),
      mType(type),
      unionArray(nullptr)
{
    ASSERT(mType);
    ASSERT(name.empty() || symbolType != SymbolType::Empty);
}

TStructure::TStructure(TSymbolTable *symbolTable,
                       const ImmutableString &name,
                       const TFieldList *fields,
                       SymbolType symbolType)
    : TSymbol(symbolTable, name, symbolType, SymbolClass::Struct), TFieldListCollection(fields)
{}

TStructure::TStructure(const TSymbolUniqueId &id,
                       const ImmutableString &name,
                       TExtension extension,
                       const TFieldList *fields)
    : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::Struct),
      TFieldListCollection(fields)
{}

void TStructure::createSamplerSymbols(const char *namePrefix,
                                      const TString &apiNamePrefix,
                                      TVector<const TVariable *> *outputSymbols,
                                      TMap<const TVariable *, TString> *outputSymbolsToAPINames,
                                      TSymbolTable *symbolTable) const
{
    ASSERT(containsSamplers());
    for (const auto *field : *mFields)
    {
        const TType *fieldType = field->type();
        if (IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
        {
            std::stringstream fieldName = sh::InitializeStream<std::stringstream>();
            fieldName << namePrefix << "_" << field->name();
            TString fieldApiName = apiNamePrefix + ".";
            fieldApiName += field->name().data();
            fieldType->createSamplerSymbols(ImmutableString(fieldName.str()), fieldApiName,
                                            outputSymbols, outputSymbolsToAPINames, symbolTable);
        }
    }
}

void TStructure::setName(const ImmutableString &name)
{
    ImmutableString *mutableName = const_cast<ImmutableString *>(&mName);
    *mutableName                 = name;
}

TInterfaceBlock::TInterfaceBlock(TSymbolTable *symbolTable,
                                 const ImmutableString &name,
                                 const TFieldList *fields,
                                 const TLayoutQualifier &layoutQualifier,
                                 SymbolType symbolType,
                                 TExtension extension)
    : TSymbol(symbolTable, name, symbolType, SymbolClass::InterfaceBlock, extension),
      TFieldListCollection(fields),
      mBlockStorage(layoutQualifier.blockStorage),
      mBinding(layoutQualifier.binding)
{
    ASSERT(name != nullptr);
}

TInterfaceBlock::TInterfaceBlock(const TSymbolUniqueId &id,
                                 const ImmutableString &name,
                                 TExtension extension,
                                 const TFieldList *fields)
    : TSymbol(id, name, SymbolType::BuiltIn, extension, SymbolClass::InterfaceBlock),
      TFieldListCollection(fields),
      mBlockStorage(EbsUnspecified),
      mBinding(0)
{}

TFunction::TFunction(TSymbolTable *symbolTable,
                     const ImmutableString &name,
                     SymbolType symbolType,
                     const TType *retType,
                     bool knownToNotHaveSideEffects)
    : TSymbol(symbolTable, name, symbolType, SymbolClass::Function, TExtension::UNDEFINED),
      mParametersVector(new TParamVector()),
      mParameters(nullptr),
      mParamCount(0u),
      returnType(retType),
      mMangledName(""),
      mOp(EOpNull),
      defined(false),
      mHasPrototypeDeclaration(false),
      mKnownToNotHaveSideEffects(knownToNotHaveSideEffects)
{
    // Functions with an empty name are not allowed.
    ASSERT(symbolType != SymbolType::Empty);
    ASSERT(name != nullptr || symbolType == SymbolType::AngleInternal);
}

void TFunction::addParameter(const TVariable *p)
{
    ASSERT(mParametersVector);
    mParametersVector->push_back(p);
    mParameters  = mParametersVector->data();
    mParamCount  = mParametersVector->size();
    mMangledName = kEmptyImmutableString;
}

void TFunction::shareParameters(const TFunction &parametersSource)
{
    mParametersVector = nullptr;
    mParameters       = parametersSource.mParameters;
    mParamCount       = parametersSource.mParamCount;
    ASSERT(parametersSource.name() == name());
    mMangledName = parametersSource.mMangledName;
}

ImmutableString TFunction::buildMangledName() const
{
    std::string newName(name().data(), name().length());
    newName += kFunctionMangledNameSeparator;

    for (size_t i = 0u; i < mParamCount; ++i)
    {
        newName += mParameters[i]->getType().getMangledName();
    }
    return ImmutableString(newName);
}

bool TFunction::isMain() const
{
    return symbolType() == SymbolType::UserDefined && name() == kMainName;
}

bool TFunction::isImageFunction() const
{
    return symbolType() == SymbolType::BuiltIn &&
           (name() == kImageSizeName || name() == kImageLoadName || name() == kImageStoreName ||
            name() == kImageAtomicExchangeName);
}

bool TFunction::isAtomicCounterFunction() const
{
    return SymbolType() == SymbolType::BuiltIn && name().beginsWith(kAtomicCounterName);
}

bool TFunction::hasSamplerInStructOrArrayParams() const
{
    for (size_t paramIndex = 0; paramIndex < mParamCount; ++paramIndex)
    {
        const TVariable *param = getParam(paramIndex);
        if (param->getType().isStructureContainingSamplers() ||
            (param->getType().isArray() && param->getType().isSampler()))
        {
            return true;
        }
    }

    return false;
}

bool TFunction::hasSamplerInStructOrArrayOfArrayParams() const
{
    for (size_t paramIndex = 0; paramIndex < mParamCount; ++paramIndex)
    {
        const TVariable *param = getParam(paramIndex);
        if (param->getType().isStructureContainingSamplers() ||
            (param->getType().isArrayOfArrays() && param->getType().isSampler()))
        {
            return true;
        }
    }

    return false;
}
}  // namespace sh


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

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

@class NIStylesheet;

/**
 * A leight-weight DOM-like object to which you attach views and stylesheets.
 *
 * @ingroup NimbusCSS
 *
 * To be clear: this is not an HTML DOM, but its intent is the same. NIDOM is designed
 * to simplify the view <=> stylesheet relationship. Add a view to the DOM and it will
 * automatically apply any applicable styles from the attached stylesheet. If the stylesheet
 * changes you can refresh the DOM and all registered views will be updated accordingly.
 *
 * Because NimbusCSS supports positioning and sizing using percentages and relative units,
 * the order of view registration is important. Generally, you should register superviews
 * first, so that any size calculations on their children can occur after their own
 * size has been determined. It's not feasible (or at least advisable) to try and
 * untangle these dependencies automatically.
 *
 *
Example Use

 *
 * NIDOM is most useful when you create a single NIDOM per view controller.
 *
@code
NIStylesheet* stylesheet = [stylesheetCache stylesheetWithPath:@"root/root.css"];
// Create a NIDOM object in your view controller.
_dom = [[NIDOM alloc] initWithStylesheet:stylesheet];
@endcode
 *
 * You then register views in the DOM during loadView or viewDidLoad.
 *
@code
// Registers a view by itself such that only "UILabel" rulesets will apply.
[_dom registerView:_label];

// Register a view with a specific CSS class. Any rulesets with the ".background" scope will
// apply to this view.
[_dom registerView:self.view withCSSClass:@"background"];
@endcode
 *
 * Once the view controller unloads its view you must unregister all of the views from your DOM.
 *
@code
- (void)viewDidUnload {
  [_dom unregisterAllViews];
}
@endcode
 */
@interface NIDOM : NSObject

// Designated initializer.

- (id)initWithStylesheet:(NIStylesheet *)stylesheet;

+ (id)domWithStylesheet:(NIStylesheet *)stylesheet;
+ (id)domWithStylesheetWithPathPrefix:(NSString *)pathPrefix paths:(NSString *)path, ...;

+ (id)domWithStylesheet:(NIStylesheet *)stylesheet andParentStyles: (NIStylesheet*) parentStyles;

- (void)registerView:(UIView *)view;
- (void)registerView:(UIView *)view withCSSClass:(NSString *)cssClass;
- (void)registerView:(UIView *)view withCSSClass:(NSString *)cssClass andId: (NSString*) viewId;

- (void)addCssClass: (NSString *) cssClass toView: (UIView*) view;
- (void)removeCssClass: (NSString*) cssClass fromView: (UIView*) view;

- (void)unregisterView:(UIView *)view;
- (void)unregisterAllViews;
- (void)refresh;
- (void)refreshView: (UIView*) view;

-(UIView*)viewById: (NSString*) viewId;

-(NSString*) descriptionForView: (UIView*) view withName: (NSString*) viewName;
-(NSString*) descriptionForAllViews;

@property (nonatomic,unsafe_unretained) id target;
@end

/** @name Creating NIDOMs */

/**
 * Initializes a newly allocated DOM with the given stylesheet.
 *
 * @fn NIDOM::initWithStylesheet:
 */

/**
 * Returns an autoreleased DOM initialized with the given stylesheet.
 *
 * @fn NIDOM::domWithStylesheet:
 */

/**
 * Returns an autoreleased DOM initialized with a nil-terminated list of file paths.
 *
 * @fn NIDOM::domWithStylesheetWithPathPrefix:paths:
 */

/**
 * Returns an autoreleased DOM initialized with the given stylesheet and a "parent" stylesheet
 * that runs first. Doing this rather than compositing stylesheets can save memory and improve
 * performance in the common case where you have a set of global styles and a bunch of view
 * or view controller specific style sheets.
 *
 * @fn NIDOM::domWithStylesheet:andParentStyles:
 */

/** @name Registering Views */

/**
 * Registers the given view with the DOM.
 *
 * The view's class will be used as the CSS selector when applying styles from the stylesheet.
 *
 * @fn NIDOM::registerView:
 */

/**
 * Registers the given view with the DOM.
 *
 * The view's class as well as the given CSS class string will be used as the CSS selectors
 * when applying styles from the stylesheet.
 *
 * @fn NIDOM::registerView:withCSSClass:
 */

/**
 * Removes the given view from from the DOM.
 *
 * Once a view has been removed from the DOM it will not be restyled when the DOM is refreshed.
 *
 * @fn NIDOM::unregisterView:
 */

/**
 * Removes all views from from the DOM.
 *
 * @fn NIDOM::unregisterAllViews
 */

/** @name Re-Applying All Styles */

/**
 * Reapplies the stylesheet to all views. Since there may be positioning involved,
 * you may need to reapply if layout or sizes change.
 *
 * @fn NIDOM::refresh
 */

/**
 * Reapplies the stylesheet to a single view. Since there may be positioning involved,
 * you may need to reapply if layout or sizes change.
 *
 * @fn NIDOM::refreshView:
 */

/**
 * Removes the association of a view with a CSS class. Note that this doesn't
 * "undo" the styles that the CSS class generated, it just stops applying them
 * in the future.
 *
 * @fn NIDOM::removeCssClass:fromView:
 */

/**
 * Create an association of a view with a CSS class and apply relevant styles
 * immediately.
 *
 * @fn NIDOM::addCssClass:toView:
 */

/** @name Dynamic View Construction */

/**
 * Using the [UIView buildSubviews:inDOM:] extension allows you to build view
 * hierarchies from JSON (or anything able to convert to NSDictionary/NSArray
 * of simple types) documents, mostly for prototyping. Those documents can
 * specify selectors, and those selectors need a target. This target property
 * will be the target for all selectors in a given DOM. Truth is it only matters
 * during buildSubviews, so in theory you could set and reset it across multiple
 * build calls if you wanted to.
 *
 * @fn NIDOM::target
 */

/** @name Debugging */

/**
 * Describe what would be done to view given the existing registrations for it. In other words, you
 * must call one of the register view variants first before asking for a description. The current
 * implementations return actual objective-c code, using viewName as the target. This allows you to
 * theoretically replace the CSS infrastructure with generated code, if you choose to. More importantly,
 * it allows you to debug what's happening with view styling.
 *
 * @fn NIDOM::descriptionForView:withName:
 */

/**
 * Call descriptionForView for all registered views, in the order they would be applied during refresh
 *
 * @fn NIDOM::descriptionForAllViews
 */


text:
sealed trait Bool {
	type If[T <: Up, F <: Up, Up] <: Up
}
sealed trait True extends Bool {
	type If[T <: Up, F <: Up, Up] = T
}
sealed trait False extends Bool {
	type If[T <: Up, F <: Up, Up] = F
}
object Bool
{
	type &&[A <: Bool, B <: Bool] = A#If[B, False, Bool]
	type || [A <: Bool, B <: Bool] = A#If[True, B, Bool]
	type Not[A <: Bool] = A#If[False, True, Bool]

	final class BoolRep[B <: Bool](val value: Boolean)
	implicit val falseRep: BoolRep[False] = new BoolRep(false)
	implicit val trueRep: BoolRep[True] = new BoolRep(true)
	def toBoolean[B <: Bool](implicit b: BoolRep[B]): Boolean = b.value
}


text:
#ifndef GROOVE_GROOVE_H
#define GROOVE_GROOVE_H

#include <stdint.h>
#include <soundio/soundio.h>

/// \cond
#ifdef __cplusplus
#define GROOVE_EXTERN_C extern "C"
#else
#define GROOVE_EXTERN_C
#endif

#if defined(_WIN32)
#if defined(GROOVE_BUILDING_LIBRARY)
#define GROOVE_EXPORT GROOVE_EXTERN_C __declspec(dllexport)
#else
#define GROOVE_EXPORT GROOVE_EXTERN_C __declspec(dllimport)
#endif
#else
#define GROOVE_EXPORT GROOVE_EXTERN_C __attribute__((visibility ("default")))
#endif
/// \endcond

/** \mainpage
 *
 * \section intro_sec Overview
 *
 * * groove.h - main header
 * * player.h - attach a GroovePlayer to a GroovePlaylist to play audio over
 *   a system audio device.
 * * encoder.h - attach a GrooveEncoder to a GroovePlaylist to encode audio.
 * * fingerprinter.h - attach a GrooveFingerprinter to a GroovePlaylist to
 *   calculate acoustid fingerprints.
 * * loudness.h - attach a GrooveLoudnessDetector to a GroovePlaylist to
 *   calculate EBU R128 loudness of tracks and albums.
 */

/** \example playlist.c
 * play several files in a row and then exit
 */

/** \example transcode.c
 * transcode one or more files into one output file
 */

/** \example fingerprint.c
 * compute the acoustid of a list of songs
 */

/** \example metadata.c
 * read or update metadata in a media file
 */

/** \example replaygain.c
 * replaygain scanner
 */

/** \example waveform.c
 * replaygain scanner
 */

/// See also ::groove_strerror
enum GrooveError {
    GrooveErrorNone                 =   0,
    GrooveErrorNoMem                =  -1,
    GrooveErrorInvalidSampleFormat  =  -2,
    GrooveErrorSystemResources      =  -3,
    GrooveErrorInvalid              =  -4,
    GrooveErrorSinkNotFound         =  -5,
    GrooveErrorNoChanges            =  -6,
    GrooveErrorFileSystem           =  -7,
    GrooveErrorUnknownFormat        =  -8,
    GrooveErrorTooManyStreams       =  -9,
    GrooveErrorEncoding             = -10,
    GrooveErrorDecoding             = -11,
    GrooveErrorStreamNotFound       = -12,
    GrooveErrorDecoderNotFound      = -13,
    GrooveErrorInvalidChannelLayout = -14,
    GrooveErrorFileNotFound         = -15,
    GrooveErrorPermissions          = -16,
    GrooveErrorEncoderNotFound      = -17,
    GrooveErrorOpeningDevice        = -18,
    GrooveErrorDeviceParams         = -19,
};

/// Specifies when the sink will stop decoding.
enum GrooveFillMode {
    /// With this behavior, the playlist will stop decoding audio when any attached
    /// sink is full, and then resume decoding audio when every sink is not full.
    /// This is the default behavior.
    GrooveFillModeAnySinkFull,
    /// With this behavior, the playlist will decode audio if any sinks
    /// are not full. If any sinks do not drain fast enough the data will buffer up
    /// in the playlist.
    GrooveFillModeEverySinkFull,
};

enum GrooveSinkFlags {
    GrooveSinkFlagPlanarOk = 0x1,
    GrooveSinkFlagInterleavedOk = 0x2,
};

#define GROOVE_LOG_QUIET    -8
#define GROOVE_LOG_ERROR    16
#define GROOVE_LOG_WARNING  24
#define GROOVE_LOG_INFO     32

/// flags to groove_file_metadata_*
#define GROOVE_TAG_MATCH_CASE      1
#define GROOVE_TAG_DONT_OVERWRITE 16

/// If the entry already exists, append to it.  Note that no
/// delimiter is added, the strings are simply concatenated.
#define GROOVE_TAG_APPEND         32

#define GROOVE_BUFFER_NO  0
#define GROOVE_BUFFER_YES 1
#define GROOVE_BUFFER_END 2

#define GROOVE_SEEK_SIZE 0x10000
#define GROOVE_SEEK_FORCE 0x20000

struct Groove;

struct GrooveAudioFormat {
    int sample_rate;
    struct SoundIoChannelLayout layout;
    enum SoundIoFormat format;
    /// 0 - nonplanar, otherwise planar
    int is_planar;
};

struct GrooveFile {
    /// read-only
    int dirty;

    /// read-only
    const char *filename;

    /// This must only be set when no GroovePlaylistItem refers to this file.
    /// ::groove_file_open estimates the duration, but it can be inaccurate.
    /// If you know the correct duration, you can supply it here.
    double override_duration;
};

struct GrooveCustomIo {
    /// set to whatever you want. Defaults to NULL.
    void *userdata;
    /// A function for refilling the buffer, may be NULL.
    int (*read_packet)(struct GrooveCustomIo *, uint8_t *buf, int buf_size);
    /// A function for writing the buffer contents, may be NULL.
    int (*write_packet)(struct GrooveCustomIo *, uint8_t *buf, int buf_size);
    /// A function for seeking to specified byte position, may be NULL.
    /// `whence` can be:
    /// * `SEEK_SET` - see fseek documentation.
    /// * `SEEK_CUR` - see fseek documentation.
    /// * `SEEK_END` - see fseek documentation.
    /// * `GROOVE_SEEK_SIZE` - (optional) if it's OR'd to whence, seek function
    ///   should return the stream size without seeking.
    /// * `GROOVE_SEEK_FORCE` - (optional) if it's OR'd to whence,
    ///   seek by any means even if it's really slow.
    /// If you don't recognize the whence parameter, return -1.
    int64_t (*seek)(struct GrooveCustomIo *, int64_t offset, int whence);
};

struct GrooveTag;

struct GroovePlaylistItem {
    /// read-only
    struct GrooveFile *file;

    /// Read-only. A volume adjustment in float format to apply to the file when it plays.
    /// This is typically used for loudness compensation, for example ReplayGain.
    /// To convert from dB to float, use exp(log(10) * 0.05 * dB_value)
    /// Modify with ::groove_playlist_set_item_gain_peak
    double gain;

    /// Read-only. The sample peak of this playlist item is assumed to be 1.0 in float
    /// format. If you know for certain that the peak is less than 1.0, you
    /// may set this value which may allow the volume adjustment to use
    /// a pure amplifier rather than a compressor. This results in slightly
    /// better audio quality.
    /// Modify with ::groove_playlist_set_item_gain_peak
    double peak;

    /// A GroovePlaylist is a doubly linked list. Use these fields to
    /// traverse the list.
    /// See also ::groove_playlist_remove
    /// See also ::groove_playlist_insert
    struct GroovePlaylistItem *prev;
    struct GroovePlaylistItem *next;
};

struct GroovePlaylist {
    /// read-only. Head of the doubly linked list which is the playlist.
    /// See also ::groove_playlist_insert
    /// See also ::groove_playlist_remove
    struct GroovePlaylistItem *head;
    /// read-only. Tail of the doubly linked list which is the playlist.
    /// See also ::groove_playlist_insert
    /// See also ::groove_playlist_remove
    struct GroovePlaylistItem *tail;

    /// read-only. volume adjustment in float format which applies to all playlist items
    /// and all sinks. defaults to 1.0.
    /// Modify with ::groove_playlist_set_gain
    double gain;
};

struct GrooveBuffer {
    /// read-only.
    /// * for interleaved audio, data[0] is the buffer.
    /// * for planar audio, each channel has a separate data pointer.
    /// * for encoded audio, data[0] is the encoded buffer.
    uint8_t **data;

    /// read-only
    struct GrooveAudioFormat format;

    /// read-only
    /// number of audio frames described by this buffer
    /// for encoded audio, this is unknown and set to 0.
    int frame_count;

    /// read-only
    /// when encoding, if item is NULL, this is a format header or trailer.
    /// otherwise, this is encoded audio for the item specified.
    /// when decoding, item is never NULL.
    struct GroovePlaylistItem *item;
    /// read-only
    double pos;

    /// read-only
    /// total number of bytes contained in this buffer
    int size;

    /// read-only
    /// presentation time stamp of the buffer
    uint64_t pts;
};

/// use this to get access to a realtime raw audio buffer
/// for example you could use it to draw a waveform or other visualization
/// GroovePlayer uses this internally to get the audio buffer for playback
struct GrooveSink {
    /// Set the allowed sample rates buffers in this sink will have. You may
    /// leave this to the default `NULL` to allow any sample rate.
    /// If the source audio format does not match any of these sample rates,
    /// sample rate conversion will be performed to convert the sample rate to
    /// GrooveSink::default_sample_rate.
    /// See also ::groove_sink_set_only_format
    struct SoundIoSampleRateRange *sample_rates;
    /// See also ::groove_sink_set_only_format
    int sample_rate_count;
    /// If the source audio format does not match, sample rate conversion will
    /// be performed to convert the sample rate to this value.
    /// See also ::groove_sink_set_only_format
    int sample_rate_default;

    /// Set the allowed channel layouts buffers in this sink will have. You may
    /// leave this to the default `NULL` to allow any channel layouts.
    /// If the source channel layout does not match any of these channel
    /// layouts, the audio will be remapped to fit
    /// GrooveSink::channel_layout_default
    /// See also ::groove_sink_set_only_format
    struct SoundIoChannelLayout *channel_layouts;
    /// See also ::groove_sink_set_only_format
    int channel_layout_count;
    /// If the source channel layout does not match, audio will be remapped to
    /// fit this channel layout. This should point to one of
    /// GrooveSink::channel_layouts.
    /// See also ::groove_sink_set_only_format
    struct SoundIoChannelLayout channel_layout_default;

    /// Set the allowed sample formats buffers in this sink will have. You may
    /// leave this to the default `NULL` to allow any sample format.
    /// If the source sample format does not match any of these sample formats,
    /// sample format conversion will be performed to convert the sample format
    /// to GrooveSink::sample_format_default.
    /// See also ::groove_sink_set_only_format
    enum SoundIoFormat *sample_formats;
    /// See also ::groove_sink_set_only_format
    int sample_format_count;
    /// If the source sample format does not match, sample format conversion
    /// will be performed to convert the sample format to this.
    /// See also ::groove_sink_set_only_format
    enum SoundIoFormat sample_format_default;

    /// See #GrooveSinkFlags
    /// * If #GrooveSinkFlagPlanarOk is set, buffers in this sink may be planar.
    /// * If #GrooveSinkFlagInterleavedOk is set, buffers in this sink may be
    ///   interleaved.
    /// Leaving both of these flags unset is the same as having them both set.
    /// See also ::groove_sink_set_only_format
    uint32_t flags;

    /// If you leave this to its default of 0, frames pulled from the sink
    /// will have sample count determined by efficiency.
    /// If you set this to a positive number, frames pulled from the sink
    /// will always have this number of samples.
    int buffer_sample_count;

    /// ::groove_sink_create defaults this to 64KB
    int buffer_size_bytes;

    /// This volume adjustment only applies to this sink.
    /// It is recommended that you leave this at 1.0 and instead adjust the
    /// gain of the playlist.
    /// If you want to change this value after you have already attached the
    /// sink to the playlist, you must use ::groove_sink_set_gain.
    /// float format. Defaults to 1.0
    double gain;

    /// set to whatever you want, defaults to `NULL`.
    void *userdata;
    /// called when the audio queue is flushed. For example, if you seek to a
    /// different location in the song.
    void (*flush)(struct GrooveSink *);
    /// called when a playlist item is deleted. Take this opportunity to remove
    /// all your references to the GroovePlaylistItem.
    void (*purge)(struct GrooveSink *, struct GroovePlaylistItem *);
    /// called when the playlist is paused
    void (*pause)(struct GrooveSink *);
    /// called when the playlist is played
    void (*play)(struct GrooveSink *);
    /// Called when a buffer is put into the sink. This is called from a thread
    /// context in which it is undefined behavior to call any libgroove functions.
    void (*filled)(struct GrooveSink *);

    /// read-only. set when you call ::groove_sink_attach. cleared when you call
    /// ::groove_sink_detach
    struct GroovePlaylist *playlist;
};

/// You should only need one of these Groove contexts.
///
/// Possible errors:
/// * GrooveErrorSystemResources
/// * GrooveErrorNoMem
GROOVE_EXPORT int groove_create(struct Groove **groove);
GROOVE_EXPORT void groove_destroy(struct Groove *groove);

GROOVE_EXPORT const char *groove_strerror(int error);

/// enable/disable logging of errors
GROOVE_EXPORT void groove_set_logging(int level);

/// returns 1 if the audio formats have the same sample rate, channel layout,
/// and sample format. returns 0 otherwise.
GROOVE_EXPORT int groove_audio_formats_equal(
        const struct GrooveAudioFormat *a,
        const struct GrooveAudioFormat *b);

GROOVE_EXPORT int groove_version_major(void);
GROOVE_EXPORT int groove_version_minor(void);
GROOVE_EXPORT int groove_version_patch(void);
GROOVE_EXPORT const char *groove_version(void);

/// given a file path and the length of the file path, allocates a new file path
/// which is in the same directory but a random filename with the same extension.
/// the file name will start with a '.'. The caller owns the memory. The length
/// of the returned path is returned in out_len. You can pass NULL for out_len.
GROOVE_EXPORT char *groove_create_rand_name(struct Groove *,
        int *out_len, const char *file, int file_len);

GROOVE_EXPORT const char *groove_tag_key(struct GrooveTag *tag);
GROOVE_EXPORT const char *groove_tag_value(struct GrooveTag *tag);

/// See also ::groove_file_destroy
GROOVE_EXPORT struct GrooveFile *groove_file_create(struct Groove *);
GROOVE_EXPORT void groove_file_destroy(struct GrooveFile *file);
/// Open a sound file on the file system.
/// * `filename` - the file to actually open
/// * `filename_hint` - this value is sometimes used to influence the algorithm
///   which decides what format the file is (for example by looking at the extension).
///   Typically you will pass the same value for `filename` and `filename_hint`.
///
/// When done with the file, call ::groove_file_close.
GROOVE_EXPORT int groove_file_open(struct GrooveFile *file,
        const char *filename, const char *filename_hint);
GROOVE_EXPORT int groove_file_open_custom(struct GrooveFile *file,
        struct GrooveCustomIo *custom_io, const char *filename_hint);
GROOVE_EXPORT void groove_file_close(struct GrooveFile *file);

GROOVE_EXPORT struct GrooveTag *groove_file_metadata_get(struct GrooveFile *file,
        const char *key, const struct GrooveTag *prev, int flags);

/// key entry to add to metadata. will be strdup'd
/// value entry to add to metadata. will be strdup'd
///    passing NULL causes existing entry to be deleted.
/// return >= 0 on success otherwise an error code < 0
/// note that this will not save the file; you must call groove_file_save
/// to do that.
GROOVE_EXPORT int groove_file_metadata_set(struct GrooveFile *file, const char *key,
        const char *value, int flags);

/// a comma separated list of short names for the format
GROOVE_EXPORT const char *groove_file_short_names(struct GrooveFile *file);

/// write changes made to metadata to disk.
/// return < 0 on error
GROOVE_EXPORT int groove_file_save(struct GrooveFile *file);
GROOVE_EXPORT int groove_file_save_as(struct GrooveFile *file, const char *filename);

/// main audio stream duration in seconds. note that this relies on a
/// combination of format headers and heuristics. It can be inaccurate.
/// The most accurate way to learn the duration of a file is to use
/// GrooveLoudnessDetector
GROOVE_EXPORT double groove_file_duration(struct GrooveFile *file);

/// get the audio format of the main audio stream of a file
GROOVE_EXPORT void groove_file_audio_format(struct GrooveFile *file,
        struct GrooveAudioFormat *audio_format);

/// A playlist keeps its sinks full.
GROOVE_EXPORT struct GroovePlaylist *groove_playlist_create(struct Groove *);
/// This will not call ::groove_file_close on any files.
/// It will remove all playlist items and sinks from the playlist
GROOVE_EXPORT void groove_playlist_destroy(struct GroovePlaylist *playlist);

GROOVE_EXPORT void groove_playlist_play(struct GroovePlaylist *playlist);
GROOVE_EXPORT void groove_playlist_pause(struct GroovePlaylist *playlist);

GROOVE_EXPORT void groove_playlist_seek(struct GroovePlaylist *playlist,
        struct GroovePlaylistItem *item, double seconds);

/// Once you add a file to the playlist, you must not destroy it until you first
/// remove it from the playlist.
/// next: the item to insert before. if NULL, you will append to the playlist.
/// gain: see GroovePlaylistItem structure. use 1.0 for no adjustment.
/// peak: see GroovePlaylistItem structure. use 1.0 for no adjustment.
/// returns the newly created playlist item, or NULL if out of memory.
GROOVE_EXPORT struct GroovePlaylistItem *groove_playlist_insert(
        struct GroovePlaylist *playlist, struct GrooveFile *file,
        double gain, double peak,
        struct GroovePlaylistItem *next);

/// This will not call ::groove_file_close on item->file
/// Item is destroyed and the address it points to is no longer valid
GROOVE_EXPORT void groove_playlist_remove(struct GroovePlaylist *playlist,
        struct GroovePlaylistItem *item);

/// Get the position of the decode head
/// both the current playlist item and the position in seconds in the playlist
/// item are given. item will be set to NULL if the playlist is empty
/// seconds will be set to -1.0 if item is NULL.
/// you may pass NULL for item or seconds
/// Note that typically you are more interested in the position of the play
/// head, not the decode head. For example, if you have a GroovePlayer attached,
/// ::groove_player_position will give you the position of the play head.
GROOVE_EXPORT void groove_playlist_position(struct GroovePlaylist *playlist,
        struct GroovePlaylistItem **item, double *seconds);

/// return 1 if the playlist is playing; 0 if it is not.
GROOVE_EXPORT int groove_playlist_playing(struct GroovePlaylist *playlist);

/// Remove all playlist items
GROOVE_EXPORT void groove_playlist_clear(struct GroovePlaylist *playlist);

/// return the count of playlist items
GROOVE_EXPORT int groove_playlist_count(struct GroovePlaylist *playlist);

GROOVE_EXPORT void groove_playlist_set_gain(struct GroovePlaylist *playlist, double gain);

GROOVE_EXPORT void groove_playlist_set_item_gain_peak(
        struct GroovePlaylist *playlist, struct GroovePlaylistItem *item,
        double gain, double peak);

/// Use this to set the fill mode using the constants above
GROOVE_EXPORT void groove_playlist_set_fill_mode(struct GroovePlaylist *playlist,
        enum GrooveFillMode mode);

GROOVE_EXPORT void groove_buffer_ref(struct GrooveBuffer *buffer);
GROOVE_EXPORT void groove_buffer_unref(struct GrooveBuffer *buffer);

GROOVE_EXPORT struct GrooveSink *groove_sink_create(struct Groove *);
GROOVE_EXPORT void groove_sink_destroy(struct GrooveSink *sink);

/// If the sink should always convert to a single audio format, this function
/// is convenient (and avoids allocating memory).
/// This function sets the following fields based on `audio_format`:
/// * GrooveSink::sample_rates
/// * GrooveSink::sample_rate_count
/// * GrooveSink::sample_rate_default
/// * GrooveSink::channel_layouts
/// * GrooveSink::channel_layout_count
/// * GrooveSink::channel_layout_default
/// * GrooveSink::sample_formats
/// * GrooveSink::sample_format_count
/// * GrooveSink::sample_format_default
/// * GrooveSink::flags
GROOVE_EXPORT void groove_sink_set_only_format(struct GrooveSink *sink,
        const struct GrooveAudioFormat *audio_format);

/// before calling this, set audio_format
/// returns 0 on success, < 0 on error
GROOVE_EXPORT int groove_sink_attach(struct GrooveSink *sink, struct GroovePlaylist *playlist);
/// returns 0 on success, < 0 on error
GROOVE_EXPORT int groove_sink_detach(struct GrooveSink *sink);

/// returns < 0 on error, #GROOVE_BUFFER_NO on aborted (block=1) or no buffer
/// ready (block=0), #GROOVE_BUFFER_YES on buffer returned, and #GROOVE_BUFFER_END
/// on end of playlist.
/// buffer is always set to either a valid GrooveBuffer or `NULL`
GROOVE_EXPORT int groove_sink_buffer_get(struct GrooveSink *sink,
        struct GrooveBuffer **buffer, int block);

/// returns < 0 on error, 0 on no buffer ready, 1 on buffer ready
/// if block is 1, block until buffer is ready
GROOVE_EXPORT int groove_sink_buffer_peek(struct GrooveSink *sink, int block);

/// See the gain property of GrooveSink. It is recommended that you leave this
/// at 1.0 and instead adjust the gain of the playlist.
/// returns 0 on success, < 0 on error
GROOVE_EXPORT int groove_sink_set_gain(struct GrooveSink *sink, double gain);

/// Set the buffer_size_bytes field of the sink while the sink is attached.
GROOVE_EXPORT void groove_sink_set_buffer_size_bytes(struct GrooveSink *sink, int buffer_size_bytes);

/// Returns the number of bytes contained in this sink.
GROOVE_EXPORT int groove_sink_get_fill_level(struct GrooveSink *sink);

/// Returns 1 if the sink contains the end of playlist sentinel, 0 otherwise.
GROOVE_EXPORT int groove_sink_contains_end_of_playlist(struct GrooveSink *sink);

#endif


text:
title:  Dievas ir sandora
date:   16/11/2019
---

### Šios savaitės tyrinėjimui skaitykite
Neh 10, 1–30; Pr 4, 8–19; Hbr 13, 20; Joz 24; Neh 10, 31–40; Hbr 8, 1–7.

>
Įsimintina eilutė:

> "Turėdami visa tai prieš akis, mes sudarome tvirtą sutartį raštu. Šiame antspauduotame rašte įrašyti vardai mūsų didžiūnų, levitų ir kunigų... Mes nepaliksime daugiau Dievo Namų" (Neh 10, 1. 40).

Kas Rašte turima omenyje kalbant apie Sandorą? Paprasčiausias šios Sandoros Rašte paaiškinimas yra tai, kad ji yra teisinių santykių tarp Dievo ir Jo tautos sukūrimas. Dievas sako: "Jūs esate Mano tauta, o Aš esu jūsų Dievas". Be to, rašytinės sandoros buvo naudojamos ir kitose senovės pasaulio tautose, dažnai tarp vadovų ir jų piliečių.

Šios sandoros buvo sudaromos, nes jos buvo naudingos abiem šalims. Vadovai rūpinsis tauta, o pastaroji mokės mokesčius. Bet su Dievu Sandora buvo kitokia. Dievui iš tiesų nebuvo iš jos jokios naudos, ir vis dėlto Jis pažadėjo būti ištikimas, net jei tauta nebūtų ištikima. Iš tiesų Sandoros palaiminimai ir prakeikimai leido izraelitams suprasti, kada prasidėjo blogi dalykai, kada jie sulaužė Sandorą.

Šią savaitę tyrinėsime Sandorą, kurią izraelitai atnaujino su Dievu Nehemijo 10, taip pat aptarsime bendrą informaciją apie Sandoros sudarymo Rašte istoriją ir svarbą.


text:
package com.eaglesakura.android.bluetooth.p2p;

import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothServerSocket;
import android.bluetooth.BluetoothSocket;
import android.content.Context;

import java.io.IOException;
import java.util.UUID;

/**
 * Bluetooth通信用親機となるサーバー
 */
@Deprecated
public class BluetoothServer extends BluetoothP2PConnector {

    final Context context;

    BluetoothSocket socket;

    /**
     * サーバーのリクエスト待ちは5分に指定する
     */
    long serverRequestTimeoutMs = 1000 * 60 * 5;

    BluetoothAdapter adapter;

    public BluetoothServer(Context context) {
        this.context = context;
        this.adapter = BluetoothAdapter.getDefaultAdapter();
    }

    /**
     * サーバーのリクエスト待ち時間を指定する
     */
    public void setServerRequestTimeoutMs(long serverRequestTimeout) {
        this.serverRequestTimeoutMs = serverRequestTimeout;
    }

    /**
     * サーバー用接続を行う
     */
    @Override
    protected boolean requestConnecting(UUID protocol) {
        try {
            BluetoothServerSocket serverSocket = adapter.listenUsingInsecureRfcommWithServiceRecord(context.getPackageName(), protocol);

            socket = serverSocket.accept((int) serverRequestTimeoutMs);
            connectDevice = socket.getRemoteDevice();

            // 1デバイスしか受け付けないため、
            // サーバーソケットは閉じる
            serverSocket.close();

            if (isRequestDisconnect()) {
                socket.close();
                return false;
            }

            startInputThread(socket);
            startOutputThread(socket);

            return true;
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * 切断を行う
     */
    @Override
    protected void requestDisconnecting() {
        if (socket != null) {
            try {
                socket.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            socket = null;
        }
    }
}


text:
package com.smartystreets.spring;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
public class ZipCodeResponse {

    @JsonProperty("input_index")
    private int inputIndex;
    @JsonProperty("input_id")
    private String inputId;
    @JsonProperty("city_states")
    private List<CityState> cityStates;
    @JsonProperty("zipcodes")
    private List<ZipCode> zipCodes;
    private String status;
    private String reason;

    public List<CityState> getCityStates() {

        return cityStates;
    }

    public void setCityStates(List<CityState> cityStates) {

        this.cityStates = cityStates;
    }

    public String getInputId() {

        return inputId;
    }

    public void setInputId(String inputId) {

        this.inputId = inputId;
    }

    public int getInputIndex() {

        return inputIndex;
    }

    public void setInputIndex(int inputIndex) {

        this.inputIndex = inputIndex;
    }

    public String getReason() {

        return reason;
    }

    public void setReason(String reason) {

        this.reason = reason;
    }

    public String getStatus() {

        return status;
    }

    public void setStatus(String status) {

        this.status = status;
    }

    public List<ZipCode> getZipCodes() {

        return zipCodes;
    }

    public void setZipCodes(List<ZipCode> zipCodes) {

        this.zipCodes = zipCodes;
    }
}


text:
var TestScript = (function() {
	// Not run during QUnit test
	function main() {
		var subNavID = "project-subnav";
		var subnavDelay = 300;
		var subnavDuration = 700;
		var activeIconFadeDuration = 800;
		// Hide project subnav so it is in jQuery queue for slide down
		$("#" + subNavID).hide();
		// Lighten and flash infinitely the $ cursor
		subNavActiveLink(activeIconFadeDuration);
		// Slide subnav down
		slideSubNavDown(subNavID, subnavDelay, subnavDuration);
	}

	// Causes the .subnav-link-active-icon to fade in and out
	// infinitely
	function subNavActiveLink(duration) {
		function infiniteFade() {
			$(this).fadeOut(duration, function() {
				$(this).fadeIn(duration, infiniteFade);
			});
		}
		setTimeout(function() {
			$('.subnav-link').each(function() {
				if ($(this).parent().hasClass('active')) {
					$(this).
						children("div").
						children('.subnav-link-active-icon').
						fadeIn(duration, infiniteFade);
				}
			});
		}, 0);
	}

	// Slide the subnav down
	function slideSubNavDown(subNavID, delay, duration) {
		setTimeout(function() {
			$('#' + subNavID).slideDown(duration, function() {});
		}, delay);
	}

	//  If not QUnit test, run main().
	//  If QUnit test, export the testable functions.
	try {
		if (QUnit) {
			// Export functions for testing...
			var ProjectsBase = {};
			ProjectsBase.slideSubNavDown = slideSubNavDown;
			ProjectsBase.subNavActiveLink = subNavActiveLink;

			return ProjectsBase;
		}
	} catch (e) {
		if (e instanceof ReferenceError) {
			$(document).ready(function() {
				main();
			});
		} else {
			throw e;
		}

	}
})();


text:
<?php
/**
 * Created by PhpStorm.
 * User: Nikolas
 * Date: 23.04.2017
 * Time: 17:58
 */

namespace InterfaceBundle\Form;

use CoreBundle\Entity\Profile;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;

class ProfileType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('name', TextType::class,[
                'required' => true,
                'label' => "Meno"
            ])
            ->add('entrys', CollectionType::class,array(
                'entry_type' => TimeTableType::class,
                'allow_add' => true,
                'label' => " "
            ))

            ->add('save', SubmitType::class, array(
                'attr' => array('class' => 'save'),
            ));

    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => Profile::class,
        ]);
    }

}


text:
using System;
using System.Globalization;
using Newtonsoft.Json;

namespace Dadata.Model
{
    public class DateRuConverter : JsonConverter
    {
        CultureInfo culture = CultureInfo.CreateSpecificCulture("ru-RU");

        public override bool CanConvert(Type objectType)
        {
            return objectType == typeof(DateTime);
        }

        public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
        {
            if (reader.Value == null)
            {
                return null;
            }
            return DateTime.Parse(reader.Value.ToString(), culture);
        }

        public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
        {
            throw new NotImplementedException();
        }
    }
}


text:
namespace KentriosiPhotosContests.Services.Contracts
{
    using KentriosiPhotoContest.Data;

    public interface IBaseService
    {
        IKentriosiPhotoData Data { get; }
    }
}


text:
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2012.04.20 at 03:09:04 PM EDT
//

package org.slc.sli.sample.entities;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;

/**
 * This descriptor defines the services provided an education organization to populations of students associated with a program.
 *
 *
Java class for ServiceDescriptor complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType name="ServiceDescriptor">
 *   <complexContent>
 *     <extension base="{http://ed-fi.org/0100}ComplexObjectType">
 *       <sequence>
 *         <element name="CodeValue" type="{http://ed-fi.org/0100}CodeValue"/>
 *         <element name="ShortDescription" type="{http://ed-fi.org/0100}ShortDescription"/>
 *         <element name="Description" type="{http://ed-fi.org/0100}Description" minOccurs="0"/>
 *         <element name="ServiceCategory" type="{http://ed-fi.org/0100}ServiceCategory" minOccurs="0"/>
 *       </sequence>
 *     </extension>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceDescriptor", propOrder = {
    "codeValue",
    "shortDescription",
    "description",
    "serviceCategory"
})
public class ServiceDescriptor
    extends ComplexObjectType
{

    @XmlElement(name = "CodeValue", required = true)
    protected String codeValue;
    @XmlElement(name = "ShortDescription", required = true)
    protected String shortDescription;
    @XmlElement(name = "Description")
    protected String description;
    @XmlElement(name = "ServiceCategory")
    protected String serviceCategory;

    /**
     * Gets the value of the codeValue property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getCodeValue() {
        return codeValue;
    }

    /**
     * Sets the value of the codeValue property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setCodeValue(String value) {
        this.codeValue = value;
    }

    /**
     * Gets the value of the shortDescription property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getShortDescription() {
        return shortDescription;
    }

    /**
     * Sets the value of the shortDescription property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setShortDescription(String value) {
        this.shortDescription = value;
    }

    /**
     * Gets the value of the description property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getDescription() {
        return description;
    }

    /**
     * Sets the value of the description property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setDescription(String value) {
        this.description = value;
    }

    /**
     * Gets the value of the serviceCategory property.
     *
     * @return
     *     possible object is
     *     {@link String }
     *
     */
    public String getServiceCategory() {
        return serviceCategory;
    }

    /**
     * Sets the value of the serviceCategory property.
     *
     * @param value
     *     allowed object is
     *     {@link String }
     *
     */
    public void setServiceCategory(String value) {
        this.serviceCategory = value;
    }

}


text:
"""
:Author Patrik Valkovic
:Created 16.03.2019 16:53
:Licence MIT
Part of grammpy

"""
from unittest import main, TestCase
from grammpy import *
from grammpy.exceptions import StartSymbolNotSetException
from grammpy.transforms import *

class A(Nonterminal): pass
class B(Nonterminal): pass
class C(Nonterminal): pass
class D(Nonterminal): pass

class SimpleTest(TestCase):
    def test_startNotSet(self):
        class Rules(Rule):
            rules = [
                ([A], [0, B]),
                ([B], [1, C]),
                ([C], [0])
            ]
        g = Grammar(terminals=[0, 1],
                    nonterminals=[A, B, C, D],
                    rules=[Rules])
        self.assertIsNone(g.start)
        with self.assertRaises(StartSymbolNotSetException):
            ContextFree.remove_unreachable_symbols(g)

if __name__ == '__main__':
    main()