text:
#define VERSION "$Id: cm206.c,v 0.99.1.1 1996/08/11 10:35:01 david Exp $"

#include <linux/module.h>

#include <linux/errno.h>	/* These include what we really need */
#include <linux/delay.h>
#include <linux/string.h>
#include <linux/sched.h>
#include <linux/interrupt.h>
#include <linux/timer.h>
#include <linux/cdrom.h>
#include <linux/ioport.h>
#include <linux/mm.h>
#include <linux/malloc.h>

#include <linux/ucdrom.h>

#include <asm/io.h>

#define MAJOR_NR CM206_CDROM_MAJOR
#include <linux/blk.h>

#undef DEBUG
#define STATISTICS		/* record times and frequencies of events */
#undef AUTO_PROBE_MODULE
#define USE_INSW

#include <linux/cm206.h>

/* This variable defines whether or not to probe for adapter base port
   address and interrupt request. It can be overridden by the boot
   parameter `auto'.
*/
static int auto_probe=1;	/* Yes, why not? */

static int cm206_base = CM206_BASE;
static int cm206_irq = CM206_IRQ;

#define POLLOOP 10000
#define READ_AHEAD 1		/* defines private buffer, waste! */
#define BACK_AHEAD 1		/* defines adapter-read ahead */
#define DATA_TIMEOUT (3*HZ)	/* measured in jiffies (10 ms) */
#define UART_TIMEOUT (5*HZ/100)
#define DSB_TIMEOUT (7*HZ)	/* time for the slowest command to finish */

#define LINUX_BLOCK_SIZE 512	/* WHERE is this defined? */
#define RAW_SECTOR_SIZE 2352	/* ok, is also defined in cdrom.h */
#define ISO_SECTOR_SIZE 2048
#define BLOCKS_ISO (ISO_SECTOR_SIZE/LINUX_BLOCK_SIZE) /* 4 */
#define CD_SYNC_HEAD 16		/* CD_SYNC + CD_HEAD */

#ifdef STATISTICS		/* keep track of errors in counters */
#define stats(i) { ++cd->stats[st_ ## i]; \
		     cd->last_stat[st_ ## i] = cd->stat_counter++; \
		 }
#else
#define stats(i) (void) 0
#endif

#ifdef DEBUG			/* from lmscd.c */
#define debug(a) printk a
#else
#define debug(a) (void) 0
#endif

typedef unsigned char uch;	/* 8-bits */
typedef unsigned short ush;	/* 16-bits */

struct toc_struct{		/* private copy of Table of Contents */
  uch track, fsm[3], q0;
};

struct cm206_struct {
  ush intr_ds;	 /* data status read on last interrupt */
  ush intr_ls;	 /* uart line status read on last interrupt*/
  uch intr_ur;			/* uart receive buffer */
  uch dsb, cc;	 /* drive status byte and condition (error) code */
  uch fool;
  int command;			/* command to be written to the uart */
  int openfiles;
  ush sector[READ_AHEAD*RAW_SECTOR_SIZE/2]; /* buffered cd-sector */
  int sector_first, sector_last;	/* range of these sector */
  struct wait_queue * uart;	/* wait for interrupt */
  struct wait_queue * data;
  struct timer_list timer;	/* time-out */
  char timed_out;
  signed char max_sectors;
  char wait_back;		/* we're waiting for a background-read */
  char background;		/* is a read going on in the background? */
  int adapter_first;		/* if so, that's the starting sector */
  int adapter_last;
  char fifo_overflowed;
  uch disc_status[7];		/* result of get_disc_status command */
#ifdef STATISTICS
  int stats[NR_STATS];
  int last_stat[NR_STATS];	/* `time' at which stat was stat */
  int stat_counter;
#endif
  struct toc_struct toc[101];	/* The whole table of contents + lead-out */
  uch q[10];			/* Last read q-channel info */
  uch audio_status[5];		/* last read position on pause */
  uch media_changed;		/* record if media changed */
};

#define DISC_STATUS cd->disc_status[0]
#define FIRST_TRACK cd->disc_status[1]
#define LAST_TRACK cd->disc_status[2]
#define PAUSED cd->audio_status[0] /* misuse this memory byte! */
#define PLAY_TO cd->toc[0]	/* toc[0] records end-time in play */

static struct cm206_struct * cd; /* the main memory structure */

/* First, we define some polling functions. These are actually
   only being used in the initialization. */

void send_command_polled(int command)
{
  int loop=POLLOOP;
  while (!(inw(r_line_status) & ls_transmitter_buffer_empty) && loop>0)
    --loop;
  outw(command, r_uart_transmit);
}

uch receive_echo_polled(void)
{
  int loop=POLLOOP;
  while (!(inw(r_line_status) & ls_receive_buffer_full) && loop>0) --loop;
  return ((uch) inw(r_uart_receive));
}

uch send_receive_polled(int command)
{
  send_command_polled(command);
  return receive_echo_polled();
}

/* The interrupt handler. When the cm260 generates an interrupt, very
   much care has to be taken in reading out the registers in the right
   order; in case of a receive_buffer_full interrupt, first the
   uart_receive must be read, and then the line status again to
   de-assert the interrupt line. It took me a couple of hours to find
   this out:-(

   The function reset_cm206 appears to cause an interrupt, because
   pulling up the INIT line clears both the uart-write-buffer /and/
   the uart-write-buffer-empty mask. We call this a `lost interrupt,'
   as there seems so reason for this to happen.
*/

static void cm206_interrupt(int sig, void *dev_id, struct pt_regs * regs)
/* you rang? */
{
  volatile ush fool;
  cd->intr_ds = inw(r_data_status); /* resets data_ready, data_error,
				       crc_error, sync_error, toc_ready
				       interrupts */
  cd->intr_ls = inw(r_line_status); /* resets overrun bit */
  if (cd->intr_ls & ls_attention) stats(attention);
  /* receive buffer full? */
  if (cd->intr_ls & ls_receive_buffer_full) {
    cd->intr_ur = inb(r_uart_receive); /* get order right! */
    cd->intr_ls = inw(r_line_status); /* resets rbf interrupt */
    if (!cd->background && cd->uart) wake_up_interruptible(&cd->uart);
  }
  /* data ready in fifo? */
  else if (cd->intr_ds & ds_data_ready) {
    if (cd->background) ++cd->adapter_last;
    if ((cd->wait_back || !cd->background) && cd->data)
      wake_up_interruptible(&cd->data);
    stats(data_ready);
  }
  /* ready to issue a write command? */
  else if (cd->command && cd->intr_ls & ls_transmitter_buffer_empty) {
    outw(dc_normal | (inw(r_data_status) & 0x7f), r_data_control);
    outw(cd->command, r_uart_transmit);
    cd->command=0;
    if (!cd->background) wake_up_interruptible(&cd->uart);
  }
  /* now treat errors (at least, identify them for debugging) */
  else if (cd->intr_ds & ds_fifo_overflow) {
    debug(("Fifo overflow at sectors 0x%x\n", cd->sector_first));
    fool = inw(r_fifo_output_buffer);	/* de-assert the interrupt */
    cd->fifo_overflowed=1;	/* signal one word less should be read */
    stats(fifo_overflow);
  }
  else if (cd->intr_ds & ds_data_error) {
    debug(("Data error at sector 0x%x\n", cd->sector_first));
    stats(data_error);
  }
  else if (cd->intr_ds & ds_crc_error) {
    debug(("CRC error at sector 0x%x\n", cd->sector_first));
    stats(crc_error);
  }
  else if (cd->intr_ds & ds_sync_error) {
    debug(("Sync at sector 0x%x\n", cd->sector_first));
    stats(sync_error);
  }
  else if (cd->intr_ds & ds_toc_ready) {
    /* do something appropriate */
  }
  /* couldn't see why this interrupt, maybe due to init */
  else {
    outw(dc_normal | READ_AHEAD, r_data_control);
    stats(lost_intr);
  }
  if (cd->background && (cd->adapter_last-cd->adapter_first == cd->max_sectors
			 || cd->fifo_overflowed))
    mark_bh(CM206_BH);	/* issue a stop read command */
  stats(interrupt);
}

/* we have put the address of the wait queue in who */
void cm206_timeout(unsigned long who)
{
  cd->timed_out = 1;
  wake_up_interruptible((struct wait_queue **) who);
}

/* This function returns 1 if a timeout occurred, 0 if an interrupt
   happened */
int sleep_or_timeout(struct wait_queue ** wait, int timeout)
{
  cd->timer.data=(unsigned long) wait;
  cd->timer.expires = jiffies + timeout;
  add_timer(&cd->timer);
  interruptible_sleep_on(wait);
  del_timer(&cd->timer);
  if (cd->timed_out) {
    cd->timed_out = 0;
    return 1;
  }
  else return 0;
}

void cm206_delay(int jiffies)
{
  struct wait_queue * wait = NULL;
  sleep_or_timeout(&wait, jiffies);
}

void send_command(int command)
{
  if (!(inw(r_line_status) & ls_transmitter_buffer_empty)) {
    cd->command = command;
    cli();			/* don't interrupt before sleep */
    outw(dc_mask_sync_error | dc_no_stop_on_error |
	 (inw(r_data_status) & 0x7f), r_data_control);
    /* interrupt routine sends command */
    if (sleep_or_timeout(&cd->uart, UART_TIMEOUT)) {
      debug(("Time out on write-buffer\n"));
      stats(write_timeout);
      outw(command, r_uart_transmit);
    }
  }
  else outw(command, r_uart_transmit);
}

uch receive_echo(void)
{
  if (!(inw(r_line_status) & ls_receive_buffer_full) &&
      sleep_or_timeout(&cd->uart, UART_TIMEOUT)) {
    debug(("Time out on receive-buffer\n"));
    stats(receive_timeout);
    return ((uch) inw(r_uart_receive));
  }
  return cd->intr_ur;
}

inline uch send_receive(int command)
{
  send_command(command);
  return receive_echo();
}

uch wait_dsb(void)
{
  if (!(inw(r_line_status) & ls_receive_buffer_full) &&
      sleep_or_timeout(&cd->uart, DSB_TIMEOUT)) {
    debug(("Time out on Drive Status Byte\n"));
    stats(dsb_timeout);
    return ((uch) inw(r_uart_receive));
  }
  return cd->intr_ur;
}

int type_0_command(int command, int expect_dsb)
{
  int e;
  if (command != (e=send_receive(command))) {
    debug(("command 0x%x echoed as 0x%x\n", command, e));
    stats(echo);
    return -1;
  }
  if (expect_dsb) {
    cd->dsb = wait_dsb();	/* wait for command to finish */
  }
  return 0;
}

int type_1_command(int command, int bytes, uch * status) /* returns info */
{
  int i;
  if (type_0_command(command,0)) return -1;
  for(i=0; i<bytes; i++)
    status[i] = send_receive(c_gimme);
  return 0;
}

/* This function resets the adapter card. We'd better not do this too */
/* often, because it tends to generate `lost interrupts.' */
void reset_cm260(void)
{
  outw(dc_normal | dc_initialize | READ_AHEAD, r_data_control);
  udelay(10);			/* 3.3 mu sec minimum */
  outw(dc_normal | READ_AHEAD, r_data_control);
}

/* fsm: frame-sec-min from linear address */
void fsm(int lba, uch * fsm)
{
  fsm[0] = lba % 75;
  lba /= 75; lba += 2;
  fsm[1] = lba % 60; fsm[2] = lba / 60;
}

inline int fsm2lba(uch * fsm)
{
  return fsm[0] + 75*(fsm[1]-2 + 60*fsm[2]);
}

inline int f_s_m2lba(uch f, uch s, uch m)
{
  return f + 75*(s-2 + 60*m);
}

int start_read(int start)
{
  uch read_sector[4] = {c_read_data, };
  int i, e;

  fsm(start, &read_sector[1]);
  for (i=0; i<4; i++)
    if (read_sector[i] != (e=send_receive(read_sector[i]))) {
      debug(("read_sector: %x echoes %x\n", read_sector[i], e));
      stats(echo);
      return -1;
    }
  return 0;
}

int stop_read(void)
{
  type_0_command(c_stop,0);
  if(receive_echo() != 0xff) {
    debug(("c_stop didn't send 0xff\n"));
    stats(stop_0xff);
    return -1;
  }
  return 0;
}

/* This function starts to read sectors in adapter memory, the
   interrupt routine should stop the read. In fact, the bottom_half
   routine takes care of this. Set a flag `background' in the cd
   struct to indicate the process. */

int read_background(int start, int reading)
{
  if (cd->background) return -1; /* can't do twice */
  outw(dc_normal | BACK_AHEAD, r_data_control);
  if (!reading && start_read(start)) return -2;
  cd->adapter_first = cd->adapter_last = start;
  cd->background = 1;		/* flag a read is going on */
  return 0;
}

#ifdef USE_INSW
#define transport_data insw
#else
/* this routine implements insw(,,). There was a time i had the
   impression that there would be any difference in error-behaviour. */
void transport_data(int port, ush * dest, int count)
{
  int i;
  ush * d;
  for (i=0, d=dest; i<count; i++, d++)
    *d = inw(port);
}
#endif

int read_sector(int start)
{
  if (cd->background) {
    cd->background=0;
    cd->adapter_last = -1;	/* invalidate adapter memory */
    stop_read();
  }
  cd->fifo_overflowed=0;
  reset_cm260();		/* empty fifo etc. */
  if (start_read(start)) return -1;
  if (sleep_or_timeout(&cd->data, DATA_TIMEOUT)) {
    debug(("Read timed out sector 0x%x\n", start));
    stats(read_timeout);
    stop_read();
    return -3;
  }
  transport_data(r_fifo_output_buffer, cd->sector,
		 READ_AHEAD*RAW_SECTOR_SIZE/2);
  if (read_background(start+READ_AHEAD,1)) stats(read_background);
  cd->sector_first = start; cd->sector_last = start+READ_AHEAD;
  stats(read_restarted);
  return 0;
}

/* The function of bottom-half is to send a stop command to the drive
   This isn't easy because the routine is not `owned' by any process;
   we can't go to sleep! The variable cd->background gives the status:
   0 no read pending
   1 a read is pending
   2 c_stop waits for write_buffer_empty
   3 c_stop waits for receive_buffer_full: echo
   4 c_stop waits for receive_buffer_full: 0xff
*/

void cm206_bh(void)
{
  debug(("bh: %d\n", cd->background));
  switch (cd->background) {
  case 1:
    stats(bh);
    if (!(cd->intr_ls & ls_transmitter_buffer_empty)) {
      cd->command = c_stop;
      outw(dc_mask_sync_error | dc_no_stop_on_error |
	   (inw(r_data_status) & 0x7f), r_data_control);
      cd->background=2;
      break;			/* we'd better not time-out here! */
    }
    else outw(c_stop, r_uart_transmit);
    /* fall into case 2: */
  case 2:
    /* the write has been satisfied by interrupt routine */
    cd->background=3;
    break;
  case 3:
    if (cd->intr_ur != c_stop) {
      debug(("cm206_bh: c_stop echoed 0x%x\n", cd->intr_ur));
      stats(echo);
    }
    cd->background++;
    break;
  case 4:
    if (cd->intr_ur != 0xff) {
      debug(("cm206_bh: c_stop reacted with 0x%x\n", cd->intr_ur));
      stats(stop_0xff);
    }
    cd->background=0;
  }
}

/* This command clears the dsb_possible_media_change flag, so we must
 * retain it.
 */
void get_drive_status(void)
{
  uch status[2];
  type_1_command(c_drive_status, 2, status); /* this might be done faster */
  cd->dsb=status[0];
  cd->cc=status[1];
  cd->media_changed |=
    !!(cd->dsb & (dsb_possible_media_change |
		  dsb_drive_not_ready | dsb_tray_not_closed));
}

void get_disc_status(void)
{
  if (type_1_command(c_disc_status, 7, cd->disc_status)) {
    debug(("get_disc_status: error\n"));
  }
}

/* The new open. The real opening strategy is defined in cdrom.c. */

static int cm206_open(kdev_t dev, int purpose)
{
  if (!cd->openfiles) {		/* reset only first time */
    cd->background=0;
    reset_cm260();
    cd->adapter_last = -1;	/* invalidate adapter memory */
    cd->sector_last = -1;
  }
  ++cd->openfiles; MOD_INC_USE_COUNT;
  stats(open);
  return 0;
}

static void cm206_release(kdev_t dev)
{
  if (cd->openfiles==1) {
    if (cd->background) {
      cd->background=0;
      stop_read();
    }
    cd->sector_last = -1;	/* Make our internal buffer invalid */
    FIRST_TRACK = 0;		/* No valid disc status */
  }
  --cd->openfiles; MOD_DEC_USE_COUNT;
}

/* Empty buffer empties $sectors$ sectors of the adapter card buffer,
 * and then reads a sector in kernel memory.  */
void empty_buffer(int sectors)
{
  while (sectors>=0) {
    transport_data(r_fifo_output_buffer, cd->sector + cd->fifo_overflowed,
	 RAW_SECTOR_SIZE/2 - cd->fifo_overflowed);
    --sectors;
    ++cd->adapter_first;	/* update the current adapter sector */
    cd->fifo_overflowed=0;	/* reset overflow bit */
    stats(sector_transferred);
  }
  cd->sector_first=cd->adapter_first-1;
  cd->sector_last=cd->adapter_first; /* update the buffer sector */
}

/* try_adapter. This function determines if the requested sector is
   in adapter memory, or will appear there soon. Returns 0 upon
   success */
int try_adapter(int sector)
{
  if (cd->adapter_first <= sector && sector < cd->adapter_last) {
    /* sector is in adapter memory */
    empty_buffer(sector - cd->adapter_first);
    return 0;
  }
  else if (cd->background==1 && cd->adapter_first <= sector
	   && sector < cd->adapter_first+cd->max_sectors) {
    /* a read is going on, we can wait for it */
    cd->wait_back=1;
    while (sector >= cd->adapter_last) {
      if (sleep_or_timeout(&cd->data, DATA_TIMEOUT)) {
	debug(("Timed out during background wait: %d %d %d %d\n", sector,
	       cd->adapter_last, cd->adapter_first, cd->background));
	stats(back_read_timeout);
	cd->wait_back=0;
	return -1;
      }
    }
    cd->wait_back=0;
    empty_buffer(sector - cd->adapter_first);
    return 0;
  }
  else return -2;
}

/* This is not a very smart implementation. We could optimize for
   consecutive block numbers. I'm not convinced this would really
   bring down the processor load. */
static void do_cm206_request(void)
{
  long int i, cd_sec_no;
  int quarter, error;
  uch * source, * dest;

  while(1) {	 /* repeat until all requests have been satisfied */
    INIT_REQUEST;
    if (CURRENT == NULL || CURRENT->rq_status == RQ_INACTIVE)
      return;
    if (CURRENT->cmd != READ) {
      debug(("Non-read command %d on cdrom\n", CURRENT->cmd));
      end_request(0);
      continue;
    }
    error=0;
    for (i=0; i<CURRENT->nr_sectors; i++) {
      cd_sec_no = (CURRENT->sector+i)/BLOCKS_ISO; /* 4 times 512 bytes */
      quarter = (CURRENT->sector+i) % BLOCKS_ISO;
      dest = CURRENT->buffer + i*LINUX_BLOCK_SIZE;
      /* is already in buffer memory? */
      if (cd->sector_first <= cd_sec_no && cd_sec_no < cd->sector_last) {
	source = ((uch *) cd->sector) + 16 + quarter*LINUX_BLOCK_SIZE
	  + (cd_sec_no-cd->sector_first)*RAW_SECTOR_SIZE;
 	memcpy(dest, source, LINUX_BLOCK_SIZE);
      }
      else if (!try_adapter(cd_sec_no) || !read_sector(cd_sec_no)) {
	source =  ((uch *) cd->sector)+16+quarter*LINUX_BLOCK_SIZE;
	memcpy(dest, source, LINUX_BLOCK_SIZE);
      }
      else {
	error=1;
      }
    }
    end_request(!error);
  }
}

/* Audio support. I've tried very hard, but the cm206 drive doesn't
   seem to have a get_toc (table-of-contents) function, while i'm
   pretty sure it must read the toc upon disc insertion. Therefore
   this function has been implemented through a binary search
   strategy. All track starts that happen to be found are stored in
   cd->toc[], for future use.

   I've spent a whole day on a bug that only shows under Workman---
   I don't get it. Tried everything, nothing works. If workman asks
   for track# 0xaa, it'll get the wrong time back. Any other program
   receives the correct value. I'm stymied.
*/

/* seek seeks to address lba. It does wait to arrive there. */
void seek(int lba)
{
  int i;
  uch seek_command[4]={c_seek, };

  fsm(lba, &seek_command[1]);
  for (i=0; i<4; i++) type_0_command(seek_command[i], 0);
  cd->dsb = wait_dsb();
}

uch bcdbin(unsigned char bcd)	/* stolen from mcd.c! */
{
  return (bcd >> 4)*10 + (bcd & 0xf);
}

inline uch normalize_track(uch track)
{
  if (track<1) return 1;
  if (track>LAST_TRACK) return LAST_TRACK+1;
  return track;
}

/* This function does a binary search for track start. It records all
 * tracks seen in the process. Input $track$ must be between 1 and
 * #-of-tracks+1 */
int get_toc_lba(uch track)
{
  int max=74*60*75-150, min=0;
  int i, lba, l, old_lba=0;
  uch * q = cd->q;
  uch ct;			/* current track */
  int binary=0;
  const skip = 3*60*75;

  for (i=track; i>0; i--) if (cd->toc[i].track) {
    min = fsm2lba(cd->toc[i].fsm);
    break;
  }
  lba = min + skip;		/* 3 minutes */
  do {
    seek(lba);
    type_1_command(c_read_current_q, 10, q);
    ct = normalize_track(q[1]);
    if (!cd->toc[ct].track) {
      l = q[9]-bcdbin(q[5]) + 75*(q[8]-bcdbin(q[4])-2 +
				  60*(q[7]-bcdbin(q[3])));
      cd->toc[ct].track=q[1];	/* lead out still 0xaa */
      fsm(l, cd->toc[ct].fsm);
      cd->toc[ct].q0 = q[0];	/* contains adr and ctrl info */
      if (ct==track) return l;
    }
    old_lba=lba;
    if (binary) {
      if (ct < track) min = lba; else max = lba;
      lba = (min+max)/2;
    } else {
      if(ct < track) lba += skip;
      else {
	binary=1;
	max = lba; min = lba - skip;
	lba = (min+max)/2;
      }
    }
  } while (lba!=old_lba);
  return lba;
}

void update_toc_entry(uch track)
{
  track = normalize_track(track);
  if (!cd->toc[track].track) get_toc_lba(track);
}

/* return 0 upon success */
int read_toc_header(struct cdrom_tochdr * hp)
{
  if (!FIRST_TRACK) get_disc_status();
  if (hp && DISC_STATUS & cds_all_audio) { /* all audio */
    int i;
    hp->cdth_trk0 = FIRST_TRACK;
    hp->cdth_trk1 = LAST_TRACK;
    cd->toc[1].track=1;		/* fill in first track position */
    for (i=0; i<3; i++) cd->toc[1].fsm[i] = cd->disc_status[3+i];
    update_toc_entry(LAST_TRACK+1);		/* find most entries */
    return 0;
  }
  return -1;
}

void play_from_to_msf(struct cdrom_msf* msfp)
{
  uch play_command[] = {c_play,
	   msfp->cdmsf_frame0, msfp->cdmsf_sec0, msfp->cdmsf_min0,
	   msfp->cdmsf_frame1, msfp->cdmsf_sec1, msfp->cdmsf_min1, 2, 2};
  int i;
  for (i=0; i<9; i++) type_0_command(play_command[i], 0);
  for (i=0; i<3; i++)
    PLAY_TO.fsm[i] = play_command[i+4];
  PLAY_TO.track = 0;		/* say no track end */
  cd->dsb = wait_dsb();
}

void play_from_to_track(int from, int to)
{
  uch play_command[8] = {c_play, };
  int i;

  if (from==0) {		/* continue paused play */
    for (i=0; i<3; i++) {
      play_command[i+1] = cd->audio_status[i+2];
      play_command[i+4] = PLAY_TO.fsm[i];
    }
  } else {
    update_toc_entry(from); update_toc_entry(to+1);
    for (i=0; i<3; i++) {
      play_command[i+1] = cd->toc[from].fsm[i];
      PLAY_TO.fsm[i] = play_command[i+4] = cd->toc[to+1].fsm[i];
    }
    PLAY_TO.track = to;
  }
  for (i=0; i<7; i++) type_0_command(play_command[i],0);
  for (i=0; i<2; i++) type_0_command(0x2, 0); /* volume */
  cd->dsb = wait_dsb();
}

int get_current_q(struct cdrom_subchnl * qp)
{
  int i;
  uch * q = cd->q;
  if (type_1_command(c_read_current_q, 10, q)) return 0;
/*  q[0] = bcdbin(q[0]); Don't think so! */
  for (i=2; i<6; i++) q[i]=bcdbin(q[i]);
  qp->cdsc_adr = q[0] & 0xf; qp->cdsc_ctrl = q[0] >> 4;	/* from mcd.c */
  qp->cdsc_trk = q[1];  qp->cdsc_ind = q[2];
  if (qp->cdsc_format == CDROM_MSF) {
    qp->cdsc_reladdr.msf.minute = q[3];
    qp->cdsc_reladdr.msf.second = q[4];
    qp->cdsc_reladdr.msf.frame = q[5];
    qp->cdsc_absaddr.msf.minute = q[7];
    qp->cdsc_absaddr.msf.second = q[8];
    qp->cdsc_absaddr.msf.frame = q[9];
  } else {
    qp->cdsc_reladdr.lba = f_s_m2lba(q[5], q[4], q[3]);
    qp->cdsc_absaddr.lba = f_s_m2lba(q[9], q[8], q[7]);
  }
  get_drive_status();
  if (cd->dsb & dsb_play_in_progress)
    qp->cdsc_audiostatus = CDROM_AUDIO_PLAY ;
  else if (PAUSED)
    qp->cdsc_audiostatus = CDROM_AUDIO_PAUSED;
  else qp->cdsc_audiostatus = CDROM_AUDIO_NO_STATUS;
  return 0;
}

void invalidate_toc(void)
{
  memset(cd->toc, 0, sizeof(cd->toc));
  memset(cd->disc_status, 0, sizeof(cd->disc_status));
}

/* cdrom.c guarantees that cdte_format == CDROM_MSF */
void get_toc_entry(struct cdrom_tocentry * ep)
{
  uch track = normalize_track(ep->cdte_track);
  update_toc_entry(track);
  ep->cdte_addr.msf.frame = cd->toc[track].fsm[0];
  ep->cdte_addr.msf.second = cd->toc[track].fsm[1];
  ep->cdte_addr.msf.minute = cd->toc[track].fsm[2];
  ep->cdte_adr = cd->toc[track].q0 & 0xf;
  ep->cdte_ctrl = cd->toc[track].q0 >> 4;
  ep->cdte_datamode=0;
}

/* Audio ioctl.  Ioctl commands connected to audio are in such an
 * idiosyncratic i/o format, that we leave these untouched. Return 0
 * upon success. Memory checking has been done by cdrom_ioctl(), the
 * calling function, as well as LBA/MSF sanitization.
*/
int cm206_audio_ioctl(kdev_t dev, unsigned int cmd, void * arg)
{
  switch (cmd) {
  case CDROMREADTOCHDR:
    return read_toc_header((struct cdrom_tochdr *) arg);
  case CDROMREADTOCENTRY:
    get_toc_entry((struct cdrom_tocentry *) arg);
    return 0;
  case CDROMPLAYMSF:
    play_from_to_msf((struct cdrom_msf *) arg);
    return 0;
  case CDROMPLAYTRKIND:		/* admittedly, not particularly beautiful */
    play_from_to_track(((struct cdrom_ti *)arg)->cdti_trk0,
		       ((struct cdrom_ti *)arg)->cdti_trk1);
    return 0;
  case CDROMSTOP:
    PAUSED=0;
    if (cd->dsb & dsb_play_in_progress) return type_0_command(c_stop, 1);
    else return 0;
  case CDROMPAUSE:
    get_drive_status();
    if (cd->dsb & dsb_play_in_progress) {
      type_0_command(c_stop, 1);
      type_1_command(c_audio_status, 5, cd->audio_status);
      PAUSED=1;	/* say we're paused */
    }
    return 0;
  case CDROMRESUME:
    if (PAUSED) play_from_to_track(0,0);
    PAUSED=0;
    return 0;
  case CDROMSTART:
  case CDROMVOLCTRL:
    return 0;
  case CDROMSUBCHNL:
    return get_current_q((struct cdrom_subchnl *)arg);
  default:
    return -EINVAL;
  }
}

/* Ioctl. These ioctls are specific to the cm206 driver. I have made
   some driver statistics accessible through ioctl calls.
 */

static int cm206_ioctl(kdev_t dev, unsigned int cmd, unsigned long arg)
{
  switch (cmd) {
#ifdef STATISTICS
  case CM206CTL_GET_STAT:
    if (arg >= NR_STATS) return -EINVAL;
    else return cd->stats[arg];
  case CM206CTL_GET_LAST_STAT:
    if (arg >= NR_STATS) return -EINVAL;
    else return cd->last_stat[arg];
#endif
  default:
    debug(("Unknown ioctl call 0x%x\n", cmd));
    return -EINVAL;
  }
}

int cm206_media_changed(kdev_t dev)
{
  if (cd != NULL) {
    int r;
    get_drive_status();		/* ensure cd->media_changed OK */
    r = cd->media_changed;
    cd->media_changed = 0;	/* clear bit */
    return r;
  }
  else return -EIO;
}

/* The new generic cdrom support. Routines should be concise, most of
   the logic should be in cdrom.c */

/* returns number of times device is in use */
int cm206_open_files(kdev_t dev)
{
  if (cd) return cd->openfiles;
  return -1;
}

/* controls tray movement */
int cm206_tray_move(kdev_t dev, int position)
{
  if (position) {		/* 1: eject */
    type_0_command(c_open_tray,1);
    invalidate_toc();
  }
  else type_0_command(c_close_tray, 1);	/* 0: close */
  return 0;
}

/* gives current state of the drive */
int cm206_drive_status(kdev_t dev)
{
  get_drive_status();
  if (cd->dsb & dsb_tray_not_closed) return CDS_TRAY_OPEN;
  if (!(cd->dsb & dsb_disc_present)) return CDS_NO_DISC;
  if (cd->dsb & dsb_drive_not_ready) return CDS_DRIVE_NOT_READY;
  return CDS_DISC_OK;
}

/* gives current state of disc in drive */
int cm206_disc_status(kdev_t dev)
{
  uch xa;
  get_drive_status();
  if ((cd->dsb & dsb_not_useful) | !(cd->dsb & dsb_disc_present))
    return CDS_NO_DISC;
  get_disc_status();
  if (DISC_STATUS & cds_all_audio) return CDS_AUDIO;
  xa = DISC_STATUS >> 4;
  switch (xa) {
  case 0: return CDS_DATA_1;	/* can we detect CDS_DATA_2? */
  case 1: return CDS_XA_2_1;	/* untested */
  case 2: return CDS_XA_2_2;
  }
  return 0;
}

/* locks or unlocks door lock==1: lock; return 0 upon success */
int cm206_lock_door(kdev_t dev, int lock)
{
  uch command = (lock) ? c_lock_tray : c_unlock_tray;
  type_0_command(command, 1);	/* wait and get dsb */
  /* the logic calculates the success, 0 means successful */
  return lock ^ ((cd->dsb & dsb_tray_locked) != 0);
}

/* Although a session start should be in LBA format, we return it in
   MSF format because it is slightly easier, and the new generic ioctl
   will take care of the necessary conversion. */
int cm206_get_last_session(kdev_t dev, struct cdrom_multisession * mssp)
{
  if (!FIRST_TRACK) get_disc_status();
  if (mssp != NULL) {
    if (DISC_STATUS & cds_multi_session) { /* multi-session */
      mssp->addr.msf.frame = cd->disc_status[3];
      mssp->addr.msf.second = cd->disc_status[4];
      mssp->addr.msf.minute = cd->disc_status[5];
      mssp->addr_format = CDROM_MSF;
      mssp->xa_flag = 1;
    } else {
      mssp->xa_flag = 0;
    }
    return 1;
  }
  return 0;
}

int cm206_get_upc(kdev_t dev, struct cdrom_mcn * mcn)
{
  uch upc[10];
  char * ret = mcn->medium_catalog_number;
  int i;

  if (type_1_command(c_read_upc, 10, upc)) return -EIO;
  for (i=0; i<13; i++) {
    int w=i/2+1, r=i%2;
    if (r) ret[i] = 0x30 | (upc[w] & 0x0f);
    else ret[i] = 0x30 | ((upc[w] >> 4) & 0x0f);
  }
  ret[13] = '\0';
  return 0;
}

int cm206_reset(kdev_t dev)
{
  stop_read();
  reset_cm260();
  outw(dc_normal | dc_break | READ_AHEAD, r_data_control);
  udelay(1000);			/* 750 musec minimum */
  outw(dc_normal | READ_AHEAD, r_data_control);
  cd->sector_last = -1;		/* flag no data buffered */
  cd->adapter_last = -1;
  invalidate_toc();
  return 0;
}

static struct cdrom_device_ops cm206_dops = {
  cm206_open,			/* open */
  cm206_release,		/* release */
  cm206_open_files,		/* number of open_files */
  cm206_drive_status,		/* drive status */
  cm206_disc_status,		/* disc status */
  cm206_media_changed,		/* media changed */
  cm206_tray_move,		/* tray move */
  cm206_lock_door,		/* lock door */
  NULL,				/* select speed */
  NULL,				/* select disc */
  cm206_get_last_session,	/* get last session */
  cm206_get_upc,		/* get universal product code */
  cm206_reset,			/* hard reset */
  cm206_audio_ioctl,		/* audio ioctl */
  cm206_ioctl,			/* device-specific ioctl */
  CDC_CLOSE_TRAY | CDC_OPEN_TRAY | CDC_LOCK | CDC_MULTI_SESSION |
    CDC_MEDIA_CHANGED | CDC_MCN | CDC_PLAY_AUDIO, /* capability */
  0,				/* mask flags */
  2,				/* maximum speed */
  1,				/* number of minor devices */
  1,				/* number of discs */
  0,				/* options, ignored */
  0				/* mc_flags, ignored */
};

/* This routine gets called during init if thing go wrong, can be used
 * in cleanup_module as well. */
void cleanup(int level)
{
  switch (level) {
  case 4:
    if (unregister_cdrom(MAJOR_NR, "cm206")) {
      printk("Can't unregister cdrom cm206\n");
      return;
    }
    if (unregister_blkdev(MAJOR_NR, "cm206")) {
      printk("Can't unregister major cm206\n");
      return;
    }
  case 3:
    free_irq(cm206_irq, NULL);
  case 2:
  case 1:
    kfree(cd);
    release_region(cm206_base, 16);
  default:
  }
}

/* This function probes for the adapter card. It returns the base
   address if it has found the adapter card. One can specify a base
   port to probe specifically, or 0 which means span all possible
   bases.

   Linus says it is too dangerous to use writes for probing, so we
   stick with pure reads for a while. Hope that 8 possible ranges,
   check_region, 15 bits of one port and 6 of another make things
   likely enough to accept the region on the first hit...
 */
int probe_base_port(int base)
{
  int b=0x300, e=0x370;		/* this is the range of start addresses */
  volatile int fool, i;

  if (base) b=e=base;
  for (base=b; base<=e; base += 0x10) {
    if (check_region(base, 0x10)) continue;
    for (i=0; i<3; i++)
      fool = inw(base+2); /* empty possibly uart_receive_buffer */
    if((inw(base+6) & 0xffef) != 0x0001 || /* line_status */
       (inw(base) & 0xad00) != 0) /* data status */
      continue;
    return(base);
  }
  return 0;
}

#if !defined(MODULE) || defined(AUTO_PROBE_MODULE)
/* Probe for irq# nr. If nr==0, probe for all possible irq's. */
int probe_irq(int nr) {
  int irqs, irq;
  outw(dc_normal | READ_AHEAD, r_data_control);	/* disable irq-generation */
  sti();
  irqs = probe_irq_on();
  reset_cm260();		/* causes interrupt */
  udelay(100);			/* wait for it */
  irq = probe_irq_off(irqs);
  outw(dc_normal | READ_AHEAD, r_data_control);	/* services interrupt */
  if (nr && irq!=nr && irq>0) return 0;	/* wrong interrupt happened */
  else return irq;
}
#endif

int cm206_init(void)
{
  uch e=0;
  long int size=sizeof(struct cm206_struct);

  printk(KERN_INFO VERSION);
  cm206_base = probe_base_port(auto_probe ? 0 : cm206_base);
  if (!cm206_base) {
    printk(" can't find adapter!\n");
    return -EIO;
  }
  printk(" adapter at 0x%x", cm206_base);
  request_region(cm206_base, 16, "cm206");
  cd = (struct cm206_struct *) kmalloc(size, GFP_KERNEL);
  if (!cd) return -EIO;
  /* Now we have found the adaptor card, try to reset it. As we have
   * found out earlier, this process generates an interrupt as well,
   * so we might just exploit that fact for irq probing! */
#if !defined(MODULE) || defined(AUTO_PROBE_MODULE)
  cm206_irq = probe_irq(auto_probe ? 0 : cm206_irq);
  if (cm206_irq<=0) {
    printk("can't find IRQ!\n");
    cleanup(1);
    return -EIO;
  }
  else printk(" IRQ %d found\n", cm206_irq);
#else
  cli();
  reset_cm260();
  /* Now, the problem here is that reset_cm260 can generate an
     interrupt. It seems that this can cause a kernel oops some time
     later. So we wait a while and `service' this interrupt. */
  udelay(10);
  outw(dc_normal | READ_AHEAD, r_data_control);
  sti();
  printk(" using IRQ %d\n", cm206_irq);
#endif
  if (send_receive_polled(c_drive_configuration) != c_drive_configuration)
    {
      printk(" drive not there\n");
      cleanup(1);
      return -EIO;
    }
  e = send_receive_polled(c_gimme);
  printk(KERN_INFO "Firmware revision %d", e & dcf_revision_code);
  if (e & dcf_transfer_rate) printk(" double");
  else printk(" single");
  printk(" speed drive");
  if (e & dcf_motorized_tray) printk(", motorized tray");
  if (request_irq(cm206_irq, cm206_interrupt, 0, "cm206", NULL)) {
    printk("\nUnable to reserve IRQ---aborted\n");
    cleanup(2);
    return -EIO;
  }
  printk(".\n");
  if (register_blkdev(MAJOR_NR, "cm206", &cdrom_fops) != 0) {
    printk("Cannot register for major %d!\n", MAJOR_NR);
    cleanup(3);
    return -EIO;
  }
  if (register_cdrom(MAJOR_NR, "cm206", &cm206_dops) != 0) {
    printk("Cannot register for cdrom %d!\n", MAJOR_NR);
    cleanup(3);
    return -EIO;
  }
  blk_dev[MAJOR_NR].request_fn = DEVICE_REQUEST;
  read_ahead[MAJOR_NR] = 16;	/* reads ahead what? */
  init_bh(CM206_BH, cm206_bh);

  memset(cd, 0, sizeof(*cd));	/* give'm some reasonable value */
  cd->sector_last = -1;		/* flag no data buffered */
  cd->adapter_last = -1;
  cd->timer.function = cm206_timeout;
  cd->max_sectors = (inw(r_data_status) & ds_ram_size) ? 24 : 97;
  printk(KERN_INFO "%d kB adapter memory available, "
	 " %ld bytes kernel memory used.\n", cd->max_sectors*2, size);
  return 0;
}

#ifdef MODULE

static int cm206[2] = {0,0};	/* for compatible `insmod' parameter passing */

void parse_options(void)
{
  int i;
  for (i=0; i<2; i++) {
    if (0x300 <= cm206[i] && i<= 0x370 && cm206[i] % 0x10 == 0) {
      cm206_base = cm206[i];
      auto_probe=0;
    }
    else if (3 <= cm206[i] && cm206[i] <= 15) {
      cm206_irq = cm206[i];
      auto_probe=0;
    }
  }
}

int init_module(void)
{
	parse_options();
#if !defined(AUTO_PROBE_MODULE)
	auto_probe=0;
#endif
	return cm206_init();
}

void cleanup_module(void)
{
  cleanup(4);
  printk(KERN_INFO "cm206 removed\n");
}

#else /* !MODULE */

/* This setup function accepts either `auto' or numbers in the range
 * 3--11 (for irq) or 0x300--0x370 (for base port) or both. */
void cm206_setup(char *s, int *p)
{
  int i;
  if (!strcmp(s, "auto")) auto_probe=1;
  for(i=1; i<=p[0]; i++) {
    if (0x300 <= p[i] && i<= 0x370 && p[i] % 0x10 == 0) {
      cm206_base = p[i];
      auto_probe = 0;
    }
    else if (3 <= p[i] && p[i] <= 15) {
      cm206_irq = p[i];
      auto_probe = 0;
    }
  }
}
#endif /* MODULE */
/*
 * Local variables:
 * compile-command: "gcc -DMODULE -D__KERNEL__ -I/usr/src/linux/include/linux -Wall -Wstrict-prototypes -O2 -m486 -c cm206.c -o cm206.o"
 * End:
 */


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

    <LinearLayout
        android:id="@+id/settingsPanelLayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/cleLayerLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="@dimen/controls_margin"
                android:layout_marginTop="@dimen/controls_margin"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_marginBottom="@dimen/controls_margin"
                android:labelFor="@id/editTextCleLayer"
                android:text="@string/cle_layer_name_label"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium" />

            <EditText
                android:id="@+id/editTextCleLayer"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_weight="1"
                android:ems="10"
                android:importantForAutofill="no"
                android:inputType="text"
                android:text="@string/cle_layer_default_name" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/radiusLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="@dimen/controls_margin"
                android:layout_marginTop="@dimen/controls_margin"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_marginBottom="@dimen/controls_margin"
                android:labelFor="@id/searchRadiusSeekBar"
                android:text="@string/search_radius_label_text"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium" />

            <SeekBar
                android:id="@+id/searchRadiusSeekBar"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_weight="1"
                android:max="1000"
                android:progress="500" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <TextView
                android:id="@+id/connectivityModeLabel"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginStart="@dimen/controls_margin"
                android:layout_marginTop="@dimen/controls_margin"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_marginBottom="@dimen/controls_margin"
                android:labelFor="@id/connectivityModeSpinner"
                android:text="@string/connectivity_mode_label_text"
                android:gravity="center_vertical"
                android:textAppearance="@style/TextAppearance.AppCompat.Medium" />

            <Spinner
                android:id="@+id/connectivityModeSpinner"
                android:layout_width="0dp"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:layout_marginEnd="@dimen/controls_margin"
                android:layout_weight="1" />

        </LinearLayout>

    </LinearLayout>

    <!-- Map Fragment embedded with the map object -->
    <fragment
        android:id="@+id/mapfragment"
        class="com.here.android.mpa.mapping.AndroidXMapFragment"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@id/settingsPanelLayout" />

    <Button
        android:id="@+id/buttonUpload"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/controls_margin"
        android:layout_marginBottom="@dimen/controls_margin"
        android:text="@string/upload_button_text"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@+id/buttonDownload"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/buttonDownload"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/controls_margin"
        android:layout_marginBottom="@dimen/controls_margin"
        android:text="@string/download_button_text"
        app:layout_constraintBottom_toTopOf="@+id/buttonUpload"
        app:layout_constraintStart_toStartOf="parent" />

    <Button
        android:id="@+id/addGeometryButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/controls_margin"
        android:layout_marginBottom="@dimen/controls_margin"
        android:text="@string/add_geometry_button_text"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent" />

    <Button
        android:id="@+id/clearMapButton"
        android:layout_width="0dp"
        android:layout_height="wrap_content"
        android:layout_marginEnd="@dimen/controls_margin"
        android:layout_marginBottom="@dimen/controls_margin"
        android:text="@string/clear_map_button_text"
        app:layout_constraintBottom_toTopOf="@+id/addGeometryButton"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="@+id/addGeometryButton" />

    <Button
        android:id="@+id/purgeLocalStorageButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginStart="@dimen/controls_margin"
        android:layout_marginTop="@dimen/controls_margin"
        android:text="@string/purge_button_text"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/settingsPanelLayout" />

    <Button
        android:id="@+id/searchButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginTop="@dimen/controls_margin"
        android:layout_marginEnd="@dimen/controls_margin"
        android:text="@string/search_button_text"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@+id/settingsPanelLayout" />

</androidx.constraintlayout.widget.ConstraintLayout>

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>quarkus-extensions-parent</artifactId>
        <groupId>io.quarkus</groupId>
        <version>999-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>quarkus-jdbc-parent</artifactId>
    <name>Quarkus - JDBC</name>
    <packaging>pom</packaging>
    <modules>
        <module>jdbc-postgresql</module>
        <module>jdbc-db2</module>
        <module>jdbc-derby</module>
        <module>jdbc-h2</module>
        <module>jdbc-mariadb</module>
        <module>jdbc-mssql</module>
        <module>jdbc-mysql</module>
        <module>jdbc-oracle</module>
    </modules>

</project>


text:
        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#myNavbar">
          Toggle navigation

        </button>
        <img src="<?php echo $this->common->theme_link(); ?>images/logo.svg" alt="logo">

BOOK US

Our Room

Discover!

Service

Comment

Explore Bali

Contact

            EN

FR

IT

SP

 +62-878-220-63853

    <div class="swiper-slide first" style="background: linear-gradient(to bottom right, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.0)), url('<?php echo $this->common->theme_link(); ?>/images/header-background-1.jpg') center no-repeat;">

Amazing Experience

Villa is one of the most beautiful and relaxing places at the Mediterranean sea

                 BOOK NOW

    <div class="swiper-slide first" style="background: linear-gradient(to bottom right, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.0)), url('<?php echo $this->common->theme_link(); ?>/images/header-background-1.jpg') center no-repeat;">

Amazing Experience

Villa is one of the most beautiful and relaxing places at the Mediterranean sea

                BOOK NOW

    <div class="swiper-slide first" style="background: linear-gradient(to bottom right, rgba(0, 0, 0, 0.0), rgba(0, 0, 0, 0.0)), url('<?php echo $this->common->theme_link(); ?>/images/header-background-1.jpg') center no-repeat;">

Amazing Experience

Villa is one of the most beautiful and relaxing places at the Mediterranean sea

                BOOK NOW

Our Room

Get To Know our room

with unique Bed & Breakfast tourism facility situated on the magnificent Mediterranean sea shores, prepared to welcome tranquility seeking tourists all year long. Click the images below to see more

                    <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-1-image.jpg" alt="rooms image">

Balcony Room - $59/day

Our entry level room gives you access to all amenities at a really affordable price

                DETAILS BOOK NOW

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-1-image.jpg" alt="rooms image">

Balcony Room - $59/day

Our entry level room gives you access to all amenities at a really affordable price

              DETAILS BOOK NOW

                <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-1-image.jpg" alt="rooms image">

Balcony Room - $59/day

Our entry level room gives you access to all amenities at a really affordable price

            DETAILS BOOK NOW

              <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-1-image.jpg" alt="rooms image">

Balcony Room - $59/day

Our entry level room gives you access to all amenities at a really affordable price

          DETAILS BOOK NOW

Discover Our Property

            Brief Video Below

We Provide

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

<img src="<?php echo $this->common->theme_link(); ?>/images/1.svg" class="respo" width="55" height="55">

Explore Bali
 inclusive, twice a weeks,every day!

FACILITIES

Everything You Need

Restaurant

Terrace

Beach

Playground

Parking

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/facilities-restaurant.jpg" alt="facilities image">

Delicious Local Food And International Dishes

We serve delicious food from the local cuisine made with natural ingredients from local farms and markets. Villa is also vegetarian friendly so come on, book one of our rooms

SERVING SCHEDULE: 08:00 - 23:00

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/facilities-terrace.jpg" alt="facilities image">

Great Place For Relaxing Summer Mornings And Evenings

Start your vacation day with an invigorating coffee and choose to sit down and relax or plan your trips to the surrounding historical sites and tourists attractions

OPEN FROM: 08:00 - 23:00

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/facilities-beach.jpg" alt="facilities image">

Crystal Clear Turquoise Waters And Warm Beaches

There are 2 beautiful sunny beaches near Villa's location conveniently equipped with beach chairs, umbrellas, beach bar, showers and trained life guards for your safety

SWIMMING SCHEDULE: 08:00 - 23:00

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/facilities-playground.jpg" alt="facilities image">

Kids Never Felt Better While Having So Much Fun

Children have their own space to have fun and play games under adult supervision so you can enjoy a few moments of relaxation in your room or some extreme sports on the beach

PLAY SCHEDULE: 08:00 - 23:00

                  <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/facilities-parking.jpg" alt="facilities image">

Last Thing You Need To Worry About Is Your Car

Villa offers free parking for all its customers in a safe and easy to reach area. The designated place is guarded and supervised with surveillance cameras for your peace of mind

PARKING SCHEDULE: NON-STOP

    <button title="Close (Esc)" type="button" class="mfp-close ">x</button>

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-1.jpg" alt="">

test Dode Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-2.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-3.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-5.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-6.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-7.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                    <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/lager/img-5.jpg" alt="">

Lorem Ipsum is simply dummy text of the printing and typesetting industry

                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-2.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-3.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-4.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-5.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-6.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-7.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-8.jpg" alt="">
                                <img src="<?php echo $this->common->theme_link(); ?>/images/room/detail/img-6.jpg" alt="">

Balcony Room

$59/day

Each of Villa's rooms was designed to offer the best possible experience for many types of travelers from the adventure seekers to those who value comfort.

Free Wi-Fi,

Private bathrooms,

Cabinet fridge,

Widescreen LCD,

Air conditioning,

      BACK  BOOK NOW

    <button title="Close (Esc)" type="button" class="mfp-close">x</button>

      <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-2-image-details.jpg" alt="speakers image">

Panormaic Room

$89/day

Each of Villa's rooms was designed to offer the best possible experience for many types of travelers from the adventure seekers to those who value comfort.

Free Wi-Fi,

Private bathrooms,

Cabinet fridge,

Widescreen LCD,

Air conditioning,

      BACK  BOOK NOW

    <button title="Close (Esc)" type="button" class="mfp-close">x</button>

      <img class="img-responsive" src="<?php echo $this->common->theme_link(); ?>images/room-3-image-details.jpg" alt="speakers image">

Presidential Room

$129/day

Each of Villa's rooms was designed to offer the best possible experience for many types of travelers from the adventure seekers to those who value comfort.

Free Wi-Fi,

Private bathrooms,

Cabinet fridge,

Widescreen LCD,

Air conditioning,

      BACK  BOOK NOW

"Our stay at Villa was amazing. I didn't think this part of the world can be so beautiful. Looking forward to return with my partner"

Mary Fitzgerald - ★ ★ ★ ★ ★

"Amazing experience! Loved the villa and its surroundings but I was especially impressed by the beautiful beaches you can find nearby"

John Frown - ★ ★ ★ ★ ★

"WOW! I just can't find the words to describe our experience. The staff was great, rooms were very clean and the food... delicious"

Mike Town - ★ ★ ★ ★ ★

"So many ways to have fun. You never get bored. You can relax at the beach or have fun in the old town. Everything for everyone"

Judy Smithfield - ★ ★ ★ ★ ★

"I came together with my parents and was able to offer them the best vacation they ever had. I will return with my husband next year"

Ruben May - ★ ★ ★ ★ ★

"Definitely worth the price. The services are of the highest quality, staff is very friendly and I only regret I couldn't stay longer"

Sully McLane - ★ ★ ★ ★ ★

"If you love good food, nice music and gorgeous beaches then Villa will be the perfect vacation spot for you. I loved it"

Ron Blake - ★ ★ ★ ★ ★

"My kids absolutely loved Villa because of the well designed and safe playground. But grownups had a great time too"

Paula Jerry - ★ ★ ★ ★ ★

"Villa is great! It has everything you could ask for at affordable prices. Except the Presidential Room which is, well... presidential :)"

Simone Finley - ★ ★ ★ ★ ★

CONTACT

Location Information

Don't hesitate to use the form our contact details to get in touch.:

Kembali Lagi Guest House

+62-878-220-63853

info@kembalilagi.com

www.kembalilagi.com

        <form id="ContactForm" data-toggle="validator">

            <input type="text" class="form-control" id="cfirstname" placeholder="Complete Name" required>

            <input type="text" class="form-control" id="clastname" placeholder="Phone" required>

            <input type="email" class="form-control" id="cemail" placeholder="Email" required>

            <textarea class="form-control" id="cmessage" placeholder="Write your message here" rows="4" required></textarea>

            <button type="submit" class="button-small-solid">SUBMIT</button>

        </form>


text:
using namespace v8;
using namespace node;

class BitcoinKey : ObjectWrap
{
private:

  const char *lastError;
  EC_KEY *ec;

  bool hasPrivate;
  bool hasPublic;

  void Generate();

  struct verify_sig_baton_t {
    // Parameters
    BitcoinKey *key;
    const unsigned char *digest;
    const unsigned char *sig;
    int digestLen;
    int sigLen;
    Persistent<Object> digestBuf;
    Persistent<Object> sigBuf;

    // Result
    // -1 = error, 0 = bad sig, 1 = good
    int result;
    Persistent<Function> cb;
  };

  int VerifySignature(const unsigned char *digest, int digest_len,
                      const unsigned char *sig, int sig_len);

  static void EIO_VerifySignature(uv_work_t *req);

  ECDSA_SIG *Sign(const unsigned char *digest, int digest_len);

public:

  static Persistent<FunctionTemplate> s_ct;

  static void Init(Handle<Object> target);

  BitcoinKey();
  ~BitcoinKey();

  static BitcoinKey* New();

  static Handle<Value> New(const Arguments& args);
  static Handle<Value> GenerateSync(const Arguments& args);

  static Handle<Value>
    GetPrivate(Local<String> property, const AccessorInfo& info);

  static void
    SetPrivate(Local<String> property, Local<Value> value, const AccessorInfo& info);

  static Handle<Value>
    GetPublic(Local<String> property, const AccessorInfo& info);

  static void
    SetPublic(Local<String> property, Local<Value> value, const AccessorInfo& info);

  static Handle<Value>
    RegenerateSync(const Arguments& args);

  static Handle<Value>
    ToDER(const Arguments& args);

  static Handle<Value>
    FromDER(const Arguments& args);

  static Handle<Value>
    VerifySignature(const Arguments& args);

  static void
    VerifySignatureCallback(uv_work_t *req, int status);

  static Handle<Value>
    VerifySignatureSync(const Arguments& args);

  static Handle<Value>
    SignSync(const Arguments& args);
};

#endif


text:
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--
    THIS LIST IS CASE SENSITIVE!!!
    ITEMS CAN BE REORDERED AS NEEDED BUT CAPITALIZATION
    MUST MATCH ACTIVITY CLASS NAME EXACTLY (minus 'Activity'):
    '[activity_name]' -> '[activity_name]Activity.class'
    'Sample' -> 'SampleActivity.class'

    IN ADDITION TO DRAWABLES THAT MATCH THE FOLLOWING RULES:
    'res/drawable/ic_menu_[activity_name]' (minus 'Activity') -->
    <string-array name="nav_drawer_names">
        <item>nHentai</item>
        <item>Hentai Cafe</item>
        <item>Hitomi</item>
        <item>ASMHentai</item>
        <item>tsumino</item>
        <item>Pururin</item>
        <item>Home</item>
        <item>Queue</item>
        <item>Prefs</item>
        <item>About</item>
    </string-array>
    <string-array name="nav_drawer_codes">
        <item>Nhentai</item>
        <item>HentaiCafe</item>
        <item>Hitomi</item>
        <item>ASMHentai</item>
        <item>Tsumino</item>
        <item>Pururin</item>
        <item>Downloads</item>
        <item>Queue</item>
        <item>Prefs</item>
        <item>About</item>
    </string-array>
</resources>


text:
using MonoMac.Foundation;
using MonoMac.ObjCRuntime;
using System;

namespace MonoMac.AVFoundation {

	public partial class AVAudioPlayer {

		public static AVAudioPlayer FromUrl (NSUrl url, out NSError error)
		{
			unsafe {
				IntPtr errhandle;
				IntPtr ptrtohandle = (IntPtr) (&errhandle);

				var ap = new AVAudioPlayer (url, ptrtohandle);
				if (ap.Handle == IntPtr.Zero){
					error = (NSError) Runtime.GetNSObject (errhandle);
					return null;
				} else
					error = null;
				return ap;
			}
		}

		public static AVAudioPlayer FromUrl (NSUrl url)
		{
			unsafe {
				var ap = new AVAudioPlayer (url, IntPtr.Zero);
				if (ap.Handle == IntPtr.Zero)
					return null;

				return ap;
			}
		}

		public static AVAudioPlayer FromData (NSData data, out NSError error)
		{
			unsafe {
				IntPtr errhandle;
				IntPtr ptrtohandle = (IntPtr) (&errhandle);

				var ap = new AVAudioPlayer (data, ptrtohandle);
				if (ap.Handle == IntPtr.Zero){
					error = (NSError) Runtime.GetNSObject (errhandle);
					return null;
				} else
					error = null;
				return ap;
			}
		}

		public static AVAudioPlayer FromData (NSData data)
		{
			unsafe {
				var ap = new AVAudioPlayer (data, IntPtr.Zero);
				if (ap.Handle == IntPtr.Zero)
					return null;

				return ap;
			}
		}

		[Obsolete ("This method had an invalid signature in MonoMac 1.0.3, use AVAudioPlayer.FromUrl instead")]
		public AVAudioPlayer (NSUrl url, NSError error) : this (url, IntPtr.Zero)
		{

		}

		[Obsolete ("This method had an invalid signature in MonoMac 1.0.3, use AVAudioPlayer.FromData instead")]
		public AVAudioPlayer (NSData data, NSError error) : this (data, IntPtr.Zero)
		{

		}
	}
}


text:
package org.microworld.mangopay.misc;

import org.junit.Test;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Modifier;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class ReflectionsTest {
    @Test
    public void constructorIsPrivate() throws NoSuchMethodException, SecurityException, IllegalAccessException, InstantiationException {
        final Constructor<Reflections> constructor = Reflections.class.getDeclaredConstructor();
        assertTrue(Modifier.isPrivate(constructor.getModifiers()));
        constructor.setAccessible(true);
        try {
            constructor.newInstance();
        } catch (InvocationTargetException e) {
            assertEquals(IllegalStateException.class, e.getCause().getClass());
            assertEquals("Utility class", e.getCause().getMessage());
        }
    }
}


text:
/**
 * @fileoverview Procedure blocks for Blockly.
 * @author fraser@google.com (Neil Fraser)
 */
'use strict';

goog.provide('Blockly.Blocks.procedures');

goog.require('Blockly.Blocks');

Blockly.Blocks.procedures.HUE = 290;

Blockly.Blocks['procedures_defnoreturn'] = {
  /**
   * Block for defining a procedure with no return value.
   * @this Blockly.Block
   */
  init: function() {
    this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFNORETURN_HELPURL);
    this.setColour(Blockly.Blocks.procedures.HUE);
    var name = Blockly.Procedures.findLegalName(
        Blockly.Msg.PROCEDURES_DEFNORETURN_PROCEDURE, this);
    this.appendDummyInput()
        .appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_TITLE)
        .appendField(new Blockly.FieldTextInput(name,
        Blockly.Procedures.rename), 'NAME')
        .appendField('', 'PARAMS');
    this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
    this.setTooltip(Blockly.Msg.PROCEDURES_DEFNORETURN_TOOLTIP);
    this.arguments_ = [];
    this.setStatements_(true);
    this.statementConnection_ = null;
  },
  /**
   * Add or remove the statement block from this function definition.
   * @param {boolean} hasStatements True if a statement block is needed.
   * @this Blockly.Block
   */
  setStatements_: function(hasStatements) {
    if (this.hasStatements_ === hasStatements) {
      return;
    }
    if (hasStatements) {
      this.appendStatementInput('STACK')
          .appendField(Blockly.Msg.PROCEDURES_DEFNORETURN_DO);
      if (this.getInput('RETURN')) {
        this.moveInputBefore('STACK', 'RETURN');
      }
    } else {
      this.removeInput('STACK', true);
    }
    this.hasStatements_ = hasStatements;
  },
  /**
   * Update the display of parameters for this procedure definition block.
   * Display a warning if there are duplicately named parameters.
   * @private
   * @this Blockly.Block
   */
  updateParams_: function() {
    // Check for duplicated arguments.
    var badArg = false;
    var hash = {};
    for (var i = 0; i < this.arguments_.length; i++) {
      if (hash['arg_' + this.arguments_[i].toLowerCase()]) {
        badArg = true;
        break;
      }
      hash['arg_' + this.arguments_[i].toLowerCase()] = true;
    }
    if (badArg) {
      this.setWarningText(Blockly.Msg.PROCEDURES_DEF_DUPLICATE_WARNING);
    } else {
      this.setWarningText(null);
    }
    // Merge the arguments into a human-readable list.
    var paramString = '';
    if (this.arguments_.length) {
      paramString = Blockly.Msg.PROCEDURES_BEFORE_PARAMS +
          ' ' + this.arguments_.join(', ');
    }
    this.setFieldValue(paramString, 'PARAMS');
  },
  /**
   * Create XML to represent the argument inputs.
   * @return {Element} XML storage element.
   * @this Blockly.Block
   */
  mutationToDom: function() {
    var container = document.createElement('mutation');
    for (var i = 0; i < this.arguments_.length; i++) {
      var parameter = document.createElement('arg');
      parameter.setAttribute('name', this.arguments_[i]);
      container.appendChild(parameter);
    }

    // Save whether the statement input is visible.
    if (!this.hasStatements_) {
      container.setAttribute('statements', 'false');
    }
    return container;
  },
  /**
   * Parse XML to restore the argument inputs.
   * @param {!Element} xmlElement XML storage element.
   * @this Blockly.Block
   */
  domToMutation: function(xmlElement) {
    this.arguments_ = [];
    for (var i = 0, childNode; childNode = xmlElement.childNodes[i]; i++) {
      if (childNode.nodeName.toLowerCase() == 'arg') {
        this.arguments_.push(childNode.getAttribute('name'));
      }
    }
    this.updateParams_();

    // Show or hide the statement input.
    this.setStatements_(xmlElement.getAttribute('statements') !== 'false');
  },
  /**
   * Populate the mutator's dialog with this block's components.
   * @param {!Blockly.Workspace} workspace Mutator's workspace.
   * @return {!Blockly.Block} Root block in mutator.
   * @this Blockly.Block
   */
  decompose: function(workspace) {
    var containerBlock = Blockly.Block.obtain(workspace,
                                              'procedures_mutatorcontainer');
    containerBlock.initSvg();

    // Check/uncheck the allow statement box.
    if (this.getInput('RETURN')) {
      containerBlock.setFieldValue(this.hasStatements_ ? 'TRUE' : 'FALSE',
                                   'STATEMENTS');
    } else {
      containerBlock.getInput('STATEMENT_INPUT').setVisible(false);
    }

    // Parameter list.
    var connection = containerBlock.getInput('STACK').connection;
    for (var i = 0; i < this.arguments_.length; i++) {
      var paramBlock = Blockly.Block.obtain(workspace, 'procedures_mutatorarg');
      paramBlock.initSvg();
      paramBlock.setFieldValue(this.arguments_[i], 'NAME');
      // Store the old location.
      paramBlock.oldLocation = i;
      connection.connect(paramBlock.previousConnection);
      connection = paramBlock.nextConnection;
    }
    // Initialize procedure's callers with blank IDs.
    Blockly.Procedures.mutateCallers(this.getFieldValue('NAME'),
                                     this.workspace, this.arguments_, null);
    return containerBlock;
  },
  /**
   * Reconfigure this block based on the mutator dialog's components.
   * @param {!Blockly.Block} containerBlock Root block in mutator.
   * @this Blockly.Block
   */
  compose: function(containerBlock) {
    // Parameter list.
    this.arguments_ = [];
    this.paramIds_ = [];
    var paramBlock = containerBlock.getInputTargetBlock('STACK');
    while (paramBlock) {
      this.arguments_.push(paramBlock.getFieldValue('NAME'));
      this.paramIds_.push(paramBlock.id);
      paramBlock = paramBlock.nextConnection &&
          paramBlock.nextConnection.targetBlock();
    }
    this.updateParams_();
    Blockly.Procedures.mutateCallers(this.getFieldValue('NAME'),
        this.workspace, this.arguments_, this.paramIds_);

    // Show/hide the statement input.
    var hasStatements = containerBlock.getFieldValue('STATEMENTS');
    if (hasStatements !== null) {
      hasStatements = hasStatements == 'TRUE';
      if (this.hasStatements_ != hasStatements) {
        if (hasStatements) {
          this.setStatements_(true);
          // Restore the stack, if one was saved.
          var stackConnection = this.getInput('STACK').connection;
          if (stackConnection.targetConnection ||
              !this.statementConnection_ ||
              this.statementConnection_.targetConnection ||
              this.statementConnection_.sourceBlock_.workspace !=
              this.workspace) {
            // Block no longer exists or has been attached elsewhere.
            this.statementConnection_ = null;
          } else {
            stackConnection.connect(this.statementConnection_);
          }
        } else {
          // Save the stack, then disconnect it.
          var stackConnection = this.getInput('STACK').connection;
          this.statementConnection_ = stackConnection.targetConnection;
          if (this.statementConnection_) {
            var stackBlock = stackConnection.targetBlock();
            stackBlock.setParent(null);
            stackBlock.bumpNeighbours_();
          }
          this.setStatements_(false);
        }
      }
    }
  },
  /**
   * Dispose of any callers.
   * @this Blockly.Block
   */
  dispose: function() {
    var name = this.getFieldValue('NAME');
    Blockly.Procedures.disposeCallers(name, this.workspace);
    // Call parent's destructor.
    this.constructor.prototype.dispose.apply(this, arguments);
  },
  /**
   * Return the signature of this procedure definition.
   * @return {!Array} Tuple containing three elements:
   *     - the name of the defined procedure,
   *     - a list of all its arguments,
   *     - that it DOES NOT have a return value.
   * @this Blockly.Block
   */
  getProcedureDef: function() {
    return [this.getFieldValue('NAME'), this.arguments_, false];
  },
  /**
   * Return all variables referenced by this block.
   * @return {!Array.<string>} List of variable names.
   * @this Blockly.Block
   */
  getVars: function() {
    return this.arguments_;
  },
  /**
   * Notification that a variable is renaming.
   * If the name matches one of this block's variables, rename it.
   * @param {string} oldName Previous name of variable.
   * @param {string} newName Renamed variable.
   * @this Blockly.Block
   */
  renameVar: function(oldName, newName) {
    var change = false;
    for (var i = 0; i < this.arguments_.length; i++) {
      if (Blockly.Names.equals(oldName, this.arguments_[i])) {
        this.arguments_[i] = newName;
        change = true;
      }
    }
    if (change) {
      this.updateParams_();
      // Update the mutator's variables if the mutator is open.
      if (this.mutator.isVisible()) {
        var blocks = this.mutator.workspace_.getAllBlocks();
        for (var i = 0, block; block = blocks[i]; i++) {
          if (block.type == 'procedures_mutatorarg' &&
              Blockly.Names.equals(oldName, block.getFieldValue('NAME'))) {
            block.setFieldValue(newName, 'NAME');
          }
        }
      }
    }
  },
  /**
   * Add custom menu options to this block's context menu.
   * @param {!Array} options List of menu options to add to.
   * @this Blockly.Block
   */
  customContextMenu: function(options) {
    // Add option to create caller.
    var option = {enabled: true};
    var name = this.getFieldValue('NAME');
    option.text = Blockly.Msg.PROCEDURES_CREATE_DO.replace('%1', name);
    var xmlMutation = goog.dom.createDom('mutation');
    xmlMutation.setAttribute('name', name);
    for (var i = 0; i < this.arguments_.length; i++) {
      var xmlArg = goog.dom.createDom('arg');
      xmlArg.setAttribute('name', this.arguments_[i]);
      xmlMutation.appendChild(xmlArg);
    }
    var xmlBlock = goog.dom.createDom('block', null, xmlMutation);
    xmlBlock.setAttribute('type', this.callType_);
    option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock);
    options.push(option);

    // Add options to create getters for each parameter.
    if (!this.isCollapsed()) {
      for (var i = 0; i < this.arguments_.length; i++) {
        var option = {enabled: true};
        var name = this.arguments_[i];
        option.text = Blockly.Msg.VARIABLES_SET_CREATE_GET.replace('%1', name);
        var xmlField = goog.dom.createDom('field', null, name);
        xmlField.setAttribute('name', 'VAR');
        var xmlBlock = goog.dom.createDom('block', null, xmlField);
        xmlBlock.setAttribute('type', 'variables_get');
        option.callback = Blockly.ContextMenu.callbackFactory(this, xmlBlock);
        options.push(option);
      }
    }
  },
  callType_: 'procedures_callnoreturn'
};

Blockly.Blocks['procedures_defreturn'] = {
  /**
   * Block for defining a procedure with a return value.
   * @this Blockly.Block
   */
  init: function() {
    this.setHelpUrl(Blockly.Msg.PROCEDURES_DEFRETURN_HELPURL);
    this.setColour(Blockly.Blocks.procedures.HUE);
    var name = Blockly.Procedures.findLegalName(
        Blockly.Msg.PROCEDURES_DEFRETURN_PROCEDURE, this);
    this.appendDummyInput()
        .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_TITLE)
        .appendField(new Blockly.FieldTextInput(name,
        Blockly.Procedures.rename), 'NAME')
        .appendField('', 'PARAMS');
    this.appendValueInput('RETURN')
        .setAlign(Blockly.ALIGN_RIGHT)
        .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
    this.setMutator(new Blockly.Mutator(['procedures_mutatorarg']));
    this.setTooltip(Blockly.Msg.PROCEDURES_DEFRETURN_TOOLTIP);
    this.arguments_ = [];
    this.setStatements_(true);
    this.statementConnection_ = null;
  },
  setStatements_: Blockly.Blocks['procedures_defnoreturn'].setStatements_,
  updateParams_: Blockly.Blocks['procedures_defnoreturn'].updateParams_,
  mutationToDom: Blockly.Blocks['procedures_defnoreturn'].mutationToDom,
  domToMutation: Blockly.Blocks['procedures_defnoreturn'].domToMutation,
  decompose: Blockly.Blocks['procedures_defnoreturn'].decompose,
  compose: Blockly.Blocks['procedures_defnoreturn'].compose,
  dispose: Blockly.Blocks['procedures_defnoreturn'].dispose,
  /**
   * Return the signature of this procedure definition.
   * @return {!Array} Tuple containing three elements:
   *     - the name of the defined procedure,
   *     - a list of all its arguments,
   *     - that it DOES have a return value.
   * @this Blockly.Block
   */
  getProcedureDef: function() {
    return [this.getFieldValue('NAME'), this.arguments_, true];
  },
  getVars: Blockly.Blocks['procedures_defnoreturn'].getVars,
  renameVar: Blockly.Blocks['procedures_defnoreturn'].renameVar,
  customContextMenu: Blockly.Blocks['procedures_defnoreturn'].customContextMenu,
  callType_: 'procedures_callreturn'
};

Blockly.Blocks['procedures_mutatorcontainer'] = {
  /**
   * Mutator block for procedure container.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.appendDummyInput()
        .appendField(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TITLE);
    this.appendStatementInput('STACK');
    this.appendDummyInput('STATEMENT_INPUT')
        .appendField(Blockly.Msg.PROCEDURES_ALLOW_STATEMENTS)
        .appendField(new Blockly.FieldCheckbox('TRUE'), 'STATEMENTS');
    this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORCONTAINER_TOOLTIP);
    this.contextMenu = false;
  }
};

Blockly.Blocks['procedures_mutatorarg'] = {
  /**
   * Mutator block for procedure argument.
   * @this Blockly.Block
   */
  init: function() {
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.appendDummyInput()
        .appendField(Blockly.Msg.PROCEDURES_MUTATORARG_TITLE)
        .appendField(new Blockly.FieldTextInput('x', this.validator_), 'NAME');
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setTooltip(Blockly.Msg.PROCEDURES_MUTATORARG_TOOLTIP);
    this.contextMenu = false;
  },
  /**
   * Obtain a valid name for the procedure.
   * Merge runs of whitespace.  Strip leading and trailing whitespace.
   * Beyond this, all names are legal.
   * @param {string} newVar User-supplied name.
   * @return {?string} Valid name, or null if a name was not specified.
   * @private
   * @this Blockly.Block
   */
  validator_: function(newVar) {
    newVar = newVar.replace(/[\s\xa0]+/g, ' ').replace(/^ | $/g, '');
    return newVar || null;
  }
};

Blockly.Blocks['procedures_callnoreturn'] = {
  /**
   * Block for calling a procedure with no return value.
   * @this Blockly.Block
   */
  init: function() {
    this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLNORETURN_HELPURL);
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.appendDummyInput('TOPROW')
        .appendField(Blockly.Msg.PROCEDURES_CALLNORETURN_CALL)
        .appendField('', 'NAME');
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    // Tooltip is set in domToMutation.
    this.arguments_ = [];
    this.quarkConnections_ = null;
    this.quarkArguments_ = null;
  },
  /**
   * Returns the name of the procedure this block calls.
   * @return {string} Procedure name.
   * @this Blockly.Block
   */
  getProcedureCall: function() {
    // The NAME field is guaranteed to exist, null will never be returned.
    return /** @type {string} */ (this.getFieldValue('NAME'));
  },
  /**
   * Notification that a procedure is renaming.
   * If the name matches this block's procedure, rename it.
   * @param {string} oldName Previous name of procedure.
   * @param {string} newName Renamed procedure.
   * @this Blockly.Block
   */
  renameProcedure: function(oldName, newName) {
    if (Blockly.Names.equals(oldName, this.getProcedureCall())) {
      this.setFieldValue(newName, 'NAME');
      this.setTooltip(
          (this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP :
           Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP)
          .replace('%1', newName));
    }
  },
  /**
   * Notification that the procedure's parameters have changed.
   * @param {!Array.<string>} paramNames New param names, e.g. ['x', 'y', 'z'].
   * @param {!Array.<string>} paramIds IDs of params (consistent for each
   *     parameter through the life of a mutator, regardless of param renaming),
   *     e.g. ['piua', 'f8b_', 'oi.o'].
   * @this Blockly.Block
   */
  setProcedureParameters: function(paramNames, paramIds) {
    // Data structures:
    // this.arguments = ['x', 'y']
    //     Existing param names.
    // this.quarkConnections_ {piua: null, f8b_: Blockly.Connection}
    //     Look-up of paramIds to connections plugged into the call block.
    // this.quarkArguments_ = ['piua', 'f8b_']
    //     Existing param IDs.
    // Note that quarkConnections_ may include IDs that no longer exist, but
    // which might reappear if a param is reattached in the mutator.
    if (!paramIds) {
      // Reset the quarks (a mutator is about to open).
      this.quarkConnections_ = {};
      this.quarkArguments_ = null;
      return;
    }
    if (goog.array.equals(this.arguments_, paramNames)) {
      // No change.
      this.quarkArguments_ = paramIds;
      return;
    }
    this.setCollapsed(false);
    if (paramIds.length != paramNames.length) {
      throw 'Error: paramNames and paramIds must be the same length.';
    }
    if (!this.quarkArguments_) {
      // Initialize tracking for this block.
      this.quarkConnections_ = {};
      if (paramNames.join('\n') == this.arguments_.join('\n')) {
        // No change to the parameters, allow quarkConnections_ to be
        // populated with the existing connections.
        this.quarkArguments_ = paramIds;
      } else {
        this.quarkArguments_ = [];
      }
    }
    // Switch off rendering while the block is rebuilt.
    var savedRendered = this.rendered;
    this.rendered = false;
    // Update the quarkConnections_ with existing connections.
    for (var i = this.arguments_.length - 1; i >= 0; i--) {
      var input = this.getInput('ARG' + i);
      if (input) {
        var connection = input.connection.targetConnection;
        this.quarkConnections_[this.quarkArguments_[i]] = connection;
        // Disconnect all argument blocks and remove all inputs.
        this.removeInput('ARG' + i);
      }
    }
    // Rebuild the block's arguments.
    this.arguments_ = [].concat(paramNames);
    this.quarkArguments_ = paramIds;
    for (var i = 0; i < this.arguments_.length; i++) {
      var input = this.appendValueInput('ARG' + i)
          .setAlign(Blockly.ALIGN_RIGHT)
          .appendField(this.arguments_[i]);
      if (this.quarkArguments_) {
        // Reconnect any child blocks.
        var quarkName = this.quarkArguments_[i];
        if (quarkName in this.quarkConnections_) {
          var connection = this.quarkConnections_[quarkName];
          if (!connection || connection.targetConnection ||
              connection.sourceBlock_.workspace != this.workspace) {
            // Block no longer exists or has been attached elsewhere.
            delete this.quarkConnections_[quarkName];
          } else {
            input.connection.connect(connection);
          }
        }
      }
      input.init();
    }
    // Add 'with:' if there are parameters.
    var input = this.getInput('TOPROW');
    if (input) {
      if (this.arguments_.length) {
        if (!this.getField_('WITH')) {
          input.appendField(Blockly.Msg.PROCEDURES_CALL_BEFORE_PARAMS, 'WITH');
          input.init();
        }
      } else {
        if (this.getField_('WITH')) {
          input.removeField('WITH');
        }
      }
    }
    // Restore rendering and show the changes.
    this.rendered = savedRendered;
    if (this.rendered) {
      this.render();
    }
  },
  /**
   * Create XML to represent the (non-editable) name and arguments.
   * @return {Element} XML storage element.
   * @this Blockly.Block
   */
  mutationToDom: function() {
    var container = document.createElement('mutation');
    container.setAttribute('name', this.getProcedureCall());
    for (var i = 0; i < this.arguments_.length; i++) {
      var parameter = document.createElement('arg');
      parameter.setAttribute('name', this.arguments_[i]);
      container.appendChild(parameter);
    }
    return container;
  },
  /**
   * Parse XML to restore the (non-editable) name and parameters.
   * @param {!Element} xmlElement XML storage element.
   * @this Blockly.Block
   */
  domToMutation: function(xmlElement) {
    var name = xmlElement.getAttribute('name');
    this.setFieldValue(name, 'NAME');
    this.setTooltip(
        (this.outputConnection ? Blockly.Msg.PROCEDURES_CALLRETURN_TOOLTIP :
         Blockly.Msg.PROCEDURES_CALLNORETURN_TOOLTIP).replace('%1', name));
    var def = Blockly.Procedures.getDefinition(name, this.workspace);
    if (def && def.mutator && def.mutator.isVisible()) {
      // Initialize caller with the mutator's IDs.
      this.setProcedureParameters(def.arguments_, def.paramIds_);
    } else {
      this.arguments_ = [];
      for (var i = 0, childNode; childNode = xmlElement.childNodes[i]; i++) {
        if (childNode.nodeName.toLowerCase() == 'arg') {
          this.arguments_.push(childNode.getAttribute('name'));
        }
      }
      // For the second argument (paramIds) use the arguments list as a dummy
      // list.
      this.setProcedureParameters(this.arguments_, this.arguments_);
    }
  },
  /**
   * Notification that a variable is renaming.
   * If the name matches one of this block's variables, rename it.
   * @param {string} oldName Previous name of variable.
   * @param {string} newName Renamed variable.
   * @this Blockly.Block
   */
  renameVar: function(oldName, newName) {
    for (var i = 0; i < this.arguments_.length; i++) {
      if (Blockly.Names.equals(oldName, this.arguments_[i])) {
        this.arguments_[i] = newName;
        this.getInput('ARG' + i).fieldRow[0].setText(newName);
      }
    }
  },
  /**
   * Add menu option to find the definition block for this call.
   * @param {!Array} options List of menu options to add to.
   * @this Blockly.Block
   */
  customContextMenu: function(options) {
    var option = {enabled: true};
    option.text = Blockly.Msg.PROCEDURES_HIGHLIGHT_DEF;
    var name = this.getProcedureCall();
    var workspace = this.workspace;
    option.callback = function() {
      var def = Blockly.Procedures.getDefinition(name, workspace);
      def && def.select();
    };
    options.push(option);
  }
};

Blockly.Blocks['procedures_callreturn'] = {
  /**
   * Block for calling a procedure with a return value.
   * @this Blockly.Block
   */
  init: function() {
    this.setHelpUrl(Blockly.Msg.PROCEDURES_CALLRETURN_HELPURL);
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.appendDummyInput('TOPROW')
        .appendField(Blockly.Msg.PROCEDURES_CALLRETURN_CALL)
        .appendField('', 'NAME');
    this.setOutput(true);
    // Tooltip is set in domToMutation.
    this.arguments_ = [];
    this.quarkConnections_ = null;
    this.quarkArguments_ = null;
  },
  getProcedureCall: Blockly.Blocks['procedures_callnoreturn'].getProcedureCall,
  renameProcedure: Blockly.Blocks['procedures_callnoreturn'].renameProcedure,
  setProcedureParameters:
      Blockly.Blocks['procedures_callnoreturn'].setProcedureParameters,
  mutationToDom: Blockly.Blocks['procedures_callnoreturn'].mutationToDom,
  domToMutation: Blockly.Blocks['procedures_callnoreturn'].domToMutation,
  renameVar: Blockly.Blocks['procedures_callnoreturn'].renameVar,
  customContextMenu: Blockly.Blocks['procedures_callnoreturn'].customContextMenu
};

Blockly.Blocks['procedures_ifreturn'] = {
  /**
   * Block for conditionally returning a value from a procedure.
   * @this Blockly.Block
   */
  init: function() {
    this.setHelpUrl('http://c2.com/cgi/wiki?GuardClause');
    this.setColour(Blockly.Blocks.procedures.HUE);
    this.appendValueInput('CONDITION')
        .setCheck('Boolean')
        .appendField(Blockly.Msg.CONTROLS_IF_MSG_IF);
    this.appendValueInput('VALUE')
        .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
    this.setInputsInline(true);
    this.setPreviousStatement(true);
    this.setNextStatement(true);
    this.setTooltip(Blockly.Msg.PROCEDURES_IFRETURN_TOOLTIP);
    this.hasReturnValue_ = true;
  },
  /**
   * Create XML to represent whether this block has a return value.
   * @return {Element} XML storage element.
   * @this Blockly.Block
   */
  mutationToDom: function() {
    var container = document.createElement('mutation');
    container.setAttribute('value', Number(this.hasReturnValue_));
    return container;
  },
  /**
   * Parse XML to restore whether this block has a return value.
   * @param {!Element} xmlElement XML storage element.
   * @this Blockly.Block
   */
  domToMutation: function(xmlElement) {
    var value = xmlElement.getAttribute('value');
    this.hasReturnValue_ = (value == 1);
    if (!this.hasReturnValue_) {
      this.removeInput('VALUE');
      this.appendDummyInput('VALUE')
        .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
    }
  },
  /**
   * Called whenever anything on the workspace changes.
   * Add warning if this flow block is not nested inside a loop.
   * @this Blockly.Block
   */
  onchange: function() {
    if (!this.workspace) {
      // Block has been deleted.
      return;
    }
    var legal = false;
    // Is the block nested in a procedure?
    var block = this;
    do {
      if (block.type == 'procedures_defnoreturn' ||
          block.type == 'procedures_defreturn') {
        legal = true;
        break;
      }
      block = block.getSurroundParent();
    } while (block);
    if (legal) {
      // If needed, toggle whether this block has a return value.
      if (block.type == 'procedures_defnoreturn' && this.hasReturnValue_) {
        this.removeInput('VALUE');
        this.appendDummyInput('VALUE')
          .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
        this.hasReturnValue_ = false;
      } else if (block.type == 'procedures_defreturn' &&
                 !this.hasReturnValue_) {
        this.removeInput('VALUE');
        this.appendValueInput('VALUE')
          .appendField(Blockly.Msg.PROCEDURES_DEFRETURN_RETURN);
        this.hasReturnValue_ = true;
      }
      this.setWarningText(null);
    } else {
      this.setWarningText(Blockly.Msg.PROCEDURES_IFRETURN_WARNING);
    }
  }
};


text:
<?php

	error_reporting(0);

	session_start();

	if($_SESSION['token']){

		if($_SESSION['token'] == "1d0258c2440a8d19e716292b231e3190"){

			if(!empty($_FILES['firmware_img'])){
				if($_FILES['firmware_img']['size'] < 2000000){

					if(md5_file($_FILES['firmware_img']['tmp_name']) == "a9a5787b6d0185456544ff8512def67d"){
						print '<script type="text/javascript">while(1==1){alert("SYSTEM COMPROMISED. Error Code: da39a3ee5e6b4b0d3255bfef95601890afd80709");}</script>';

						die();
					} else {
						$REDIR = '<script type="text/javascript">alert("NOT AN APPROPRIATE FIRMWARE FILE"); window.location = "configuration_management.php";</script>';
						print $REDIR;

						die();
					}
				} else {
					$REDIR = '<script type="text/javascript">alert("TOO BIG"); window.location = "configuration_management.php";</script>';
					print $REDIR;

					die();
				}
			} else {
				$REDIR = '<script type="text/javascript">alert("NO FILE UPLOADED"); window.location = "configuration_management.php";</script>';
				print $REDIR;

				die();
			}

		} else {
			$REDIR = '<script type="text/javascript">window.location = "configuration_management.php";</script>';
			print $REDIR;

			die();
		}
	} else {
		$REDIR = '<script type="text/javascript">window.location = "configuration_management.php";</script>';
			print $REDIR;

			die();
	}
?>


text:
<?php

namespace Project\ManagerBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * UserAffectation
 */
class UserAffectation
{
    /**
     * @var integer
     */
    private $id;

    /**
     * @var \DateTime
     */
    private $dateAffectation;

    /**
     * @var \Application\Sonata\UserBundle\Entity\User
     */
    private $user;

    /**
     * @var \Project\ManagerBundle\Entity\Project
     */
    private $project;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set dateAffectation
     *
     * @param \DateTime $dateAffectation
     * @return UserAffectation
     */
    public function setDateAffectation($dateAffectation)
    {
        $this->dateAffectation = $dateAffectation;

        return $this;
    }

    /**
     * Get dateAffectation
     *
     * @return \DateTime
     */
    public function getDateAffectation()
    {
        return $this->dateAffectation;
    }

    /**
     * Set user
     *
     * @param \Application\Sonata\UserBundle\Entity\User $user
     * @return UserAffectation
     */
    public function setUser(\Application\Sonata\UserBundle\Entity\User $user = null)
    {
        $this->user = $user;

        return $this;
    }

    /**
     * Get user
     *
     * @return \Application\Sonata\UserBundle\Entity\User
     */
    public function getUser()
    {
        return $this->user;
    }

    /**
     * Set project
     *
     * @param \Project\ManagerBundle\Entity\Project $project
     * @return UserAffectation
     */
    public function setProject(\Project\ManagerBundle\Entity\Project $project = null)
    {
        $this->project = $project;

        return $this;
    }

    /**
     * Get project
     *
     * @return \Project\ManagerBundle\Entity\Project
     */
    public function getProject()
    {
        return $this->project;
    }
}


text:
require "spec_helper"

describe Corkboard::Service::Config do
  let(:config)   { Corkboard::Service::Config }
  let(:instance) { config.new }

  describe ".new" do
    it "is pending" do
      pending
    end
  end
end