Exemplo n.º 1
0
bool wxHtmlContainerCell::ProcessMouseClick(wxHtmlWindowInterface *window,
        const wxPoint& pos,
        const wxMouseEvent& event)
{
#if WXWIN_COMPATIBILITY_2_6
    wxHtmlCellOnMouseClickCompatHelper compat(window, pos, event);
    return compat.CallOnMouseClick(this);
}
Exemplo n.º 2
0
bool parseAutoincrementColumnComment ( std::string comment, uint64_t& startValue )
{
	algorithm::to_upper(comment);
	regex compat("[[:space:]]*AUTOINCREMENT[[:space:]]*", regex_constants::extended);
	bool autoincrement = false;
	boost::match_results<std::string::const_iterator> what;
	std::string::const_iterator start, end;
	start = comment.begin();
	end = comment.end();   
	boost::match_flag_type flags = boost::match_default;
	if (boost::regex_search(start, end, what, compat, flags))   	
	{	
		if (what[0].matched)
		{
			string params (&(*(what[0].second)));
			unsigned i = params.find_first_of(",");
			if ( i <= params.length() )
			{
				string startVal = params.substr(i+1, params.length());
				//get rid of possible empty space
				i = startVal.find_first_not_of(" ");
				if ( i <= startVal.length() )
				{
					startVal = startVal.substr( i, startVal.length());
					//; is the seperator between compression and autoincrement comments.
					i = startVal.find_first_of(";");
					if ( i <= startVal.length() )
					{
						startVal = startVal.substr( 0,i);
					}
					
					i = startVal.find_last_not_of(" ");
					if ( i <= startVal.length() )
					{
						startVal = startVal.substr( 0,i+1);
					}
					errno = 0;
					char *ep = NULL;
					const char *str = startVal.c_str();
					startValue = strtoll(str, &ep, 10);
					//  (no digits) || (more chars)  || (other errors & value = 0)
					if ((ep == str) || (*ep != '\0') || (errno != 0))
					{
						throw runtime_error (IDBErrorInfo::instance()->errorMsg(ERR_INVALID_START_VALUE));
					}
				}
			}
			else
			{
				startValue = 1;
			}
			autoincrement = true;
		}
	}
	
	return autoincrement;
}
Exemplo n.º 3
0
	// Subtract to find range difference (distance(iter1, iter2))
	difference_type operator-(const _MyIter& right_iter) const
	{
		// The two iterators should both belong to the same container this can
		// effectively be checked by comparing the address' of the container

		// It appears that two instances of the same class have access to the other instances private (they are friends)
		compat(right_iter);
		return mCurrentPosition - right_iter.mCurrentPosition;
	}
Exemplo n.º 4
0
bool wxHtmlCell::ProcessMouseClick(wxHtmlWindowInterface *window,
                                   const wxPoint& pos,
                                   const wxMouseEvent& event)
{
    wxCHECK_MSG( window, false, wxT("window interface must be provided") );

#if WXWIN_COMPATIBILITY_2_6
    // NB: this hack puts the body of ProcessMouseClick() into OnMouseClick()
    //     (for which it has to pass the arguments and return value via a
    //     helper variable because these two methods have different
    //     signatures), so that old code overriding OnMouseClick will continue
    //     to work
    wxHtmlCellOnMouseClickCompatHelper compat(window, pos, event);
    return compat.CallOnMouseClick(this);
}
Exemplo n.º 5
0
/*
 * Compat hack for applications/libraries we care about. Retrofit Linux 3.12
 * style APIs.
 */
ssize_t check_old_abi(struct file *filp, const char __user *buf, size_t count)
{
	struct ib_uverbs_cmd_hdr hdr;
	int			 tmp;
	struct ib_uverbs_file *file = filp->private_data;

	if (copy_from_user(&hdr, buf, sizeof hdr))
		return -EFAULT;

	tmp = hdr.command & IB_USER_VERBS_CMD_COMMAND_MASK;
	if ((tmp >= 52) && (tmp <= 53)) {
		return compat_ex(file, count, buf);
	} else if (tmp == IB_USER_VERBS_CMD_MODIFY_QP) {
		return compat(file, count, buf);
	} else if (tmp == 56) {
		return compat_query(file, count, buf);
	} else if (tmp == IB_USER_VERBS_CMD_QUERY_QP) {
		panic("query_qp API difference not handled\n");
	}

	/* Continue with processing this command */
	return 0;
}
Exemplo n.º 6
0
struct sysent sunsys[] = {
	{ 0, 0, nosys },			/* 0 = nosys syscall */
	{ 1, 4, exit },			/* 1 = exit */
	{ 0, 0, fork },			/* 2 = fork */
	{ 3, 12, read },			/* 3 = read */
	{ 3, 12, write },			/* 4 = write */
	{ 3, 12, open },			/* 5 = open */
	{ 1, 4, close },			/* 6 = close */
	{ 4, 16, sun_wait4 },			/* 7 = sun_wait4 */
	{ 2, 8, sun_creat },			/* 8 = sun_creat */
	{ 2, 8, link },			/* 9 = link */
	{ 1, 4, unlink },			/* 10 = unlink */
	{ 2, 8, sun_execv },			/* 11 = sun_execv */
	{ 1, 4, chdir },			/* 12 = chdir */
	{ compat(0,sun_time) },		/* 13 = old sun_time */
	{ 3, 12, mknod },			/* 14 = mknod */
	{ 2, 8, chmod },			/* 15 = chmod */
	{ 3, 12, chown },			/* 16 = chown */
	{ 1, 4, obreak },			/* 17 = break */
	{ compat(2,sun_stat) },		/* 18 = old sun_stat */
	{ 3, 12, compat_43_lseek },			/* 19 = compat_43_lseek */
	{ 0, 0, getpid },			/* 20 = getpid */
	{ 0, 0, nosys },			/* 21 = obsolete sun_old_mount */
	{ 0, 0, nosys },			/* 22 = System V umount */
	{ compat(1,setuid) },		/* 23 = old setuid */
	{ 0, 0, getuid },			/* 24 = getuid */
	{ compat(1,sun_stime) },		/* 25 = old sun_stime */
	{ 0, 0, nosys },			/* 26 = sun_ptrace */
	{ compat(1,sun_alarm) },		/* 27 = old sun_alarm */
	{ compat(1,sun_fstat) },		/* 28 = old sun_fstat */
Exemplo n.º 7
0
#define compatdf12(n, name) 0, (sy_call_t *)sys_nosys
#endif

/* The casts are bogus but will do for now. */
struct sysent sysent[] = {
#ifdef COMPAT_43
#endif
	{ 0, (sy_call_t *)sys_nosys },			/* 0 = syscall */
	{ AS(exit_args), (sy_call_t *)sys_exit },	/* 1 = exit */
	{ 0, (sy_call_t *)sys_fork },			/* 2 = fork */
	{ AS(read_args), (sy_call_t *)sys_read },	/* 3 = read */
	{ AS(write_args), (sy_call_t *)sys_write },	/* 4 = write */
	{ AS(open_args), (sy_call_t *)sys_open },	/* 5 = open */
	{ AS(close_args), (sy_call_t *)sys_close },	/* 6 = close */
	{ AS(wait_args), (sy_call_t *)sys_wait4 },	/* 7 = wait4 */
	{ compat(AS(ocreat_args),creat) },		/* 8 = old creat */
	{ AS(link_args), (sy_call_t *)sys_link },	/* 9 = link */
	{ AS(unlink_args), (sy_call_t *)sys_unlink },	/* 10 = unlink */
	{ 0, (sy_call_t *)sys_nosys },			/* 11 = obsolete execv */
	{ AS(chdir_args), (sy_call_t *)sys_chdir },	/* 12 = chdir */
	{ AS(fchdir_args), (sy_call_t *)sys_fchdir },	/* 13 = fchdir */
	{ AS(mknod_args), (sy_call_t *)sys_mknod },	/* 14 = mknod */
	{ AS(chmod_args), (sy_call_t *)sys_chmod },	/* 15 = chmod */
	{ AS(chown_args), (sy_call_t *)sys_chown },	/* 16 = chown */
	{ AS(obreak_args), (sy_call_t *)sys_obreak },	/* 17 = break */
	{ AS(getfsstat_args), (sy_call_t *)sys_getfsstat },	/* 18 = getfsstat */
	{ compat(AS(olseek_args),lseek) },		/* 19 = old lseek */
	{ 0, (sy_call_t *)sys_getpid },			/* 20 = getpid */
	{ AS(mount_args), (sy_call_t *)sys_mount },	/* 21 = mount */
	{ AS(unmount_args), (sy_call_t *)sys_unmount },	/* 22 = unmount */
	{ AS(setuid_args), (sy_call_t *)sys_setuid },	/* 23 = setuid */
Exemplo n.º 8
0
int main(int argc, char *argv[])
{
	int n,
		show_days = 0,
		but_stat  = 0,
		microtm   = 0,
		running   = 0,
		force     = 0;
	time_t
		last_time = 0;
	char
		*geometry = NULL,
		*xdisplay = NULL;
	static int signals[] =
		{SIGALRM, SIGHUP, SIGINT, SIGPIPE, SIGTERM, SIGUSR1, SIGUSR2, 0};
	XEvent Event;

	assert(sizeof(char) == 1);

	umask(077);
	do_opts(argc, argv, &show_days, &xdisplay, &geometry, &force);

	path_len = strlen(getenv("HOME")) + strlen("/.wmwork/worklog") + 1;
	if ((dirName = malloc(path_len)) == NULL || (logname = malloc(path_len)) == NULL || (lockname = malloc(path_len)) == NULL) {
		fprintf(stderr, "%s: cannot allocate memory for path variable\n", PACKAGE_NAME);
		fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
		exit(1);
	}
	snprintf(dirName,  path_len, "%s/.wmwork", getenv("HOME"));
	snprintf(logname,  path_len, "%s/worklog", dirName);
	snprintf(lockname, path_len, "%s/.#LOCK",  dirName);
	if (chdir(dirName) < 0) {
		if (errno == ENOENT) {
			if (mkdir(dirName, 0777)) {
				fprintf(stderr, "%s: cannot mkdir '%s'\n", PACKAGE_NAME, dirName);
				fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
				exit(1);
			}
			compat();
		} else {
			fprintf(stderr, "%s: cannot chdir into '%s'\n", PACKAGE_NAME, dirName);
			fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
			exit(1);
		}
	}

	for (n = 0; signals[n]; n++) {
		if (signal(signals[n], handler) == SIG_ERR) {
			fprintf(stderr, "%s: cannot set handler for signal %d\n", PACKAGE_NAME, signals[n]);
			fprintf(stderr, "%s: %s\n", PACKAGE_NAME, strerror(errno));
		}
	}

	make_lock(force);
	atexit(at_exit);
	read_log();
	current = first;

	initXwindow(xdisplay);
	createXBMfromXPM(wmwork_mask_bits, wmwork_master_xpm, 64, 64);
	openXwindow(argc, argv, wmwork_master_xpm, wmwork_mask_bits, 64, 64, geometry, NULL);
	AddMouseRegion(BUT_START,  5, 48, 22, 58);
	AddMouseRegion(BUT_PAUSE, 23, 48, 40, 58);
	AddMouseRegion(BUT_STOP,  41, 48, 58, 58);
	AddMouseRegion(BUT_PREV,   5, 33, 16, 43);
	AddMouseRegion(BUT_NEXT,  47, 33, 58, 43);
	drawTime(current->time, sess_time, microtm, show_days, running);
	drawProject(current->name);

	while (1) {
		last_time = now.tv_sec;
		gettimeofday(&now, &tz);
		if (running) {
			current->time += now.tv_sec - last_time;
			sess_time     += now.tv_sec - last_time;
			microtm        = now.tv_usec;
			drawTime(current->time, sess_time, microtm, show_days, running);
			RedrawWindow();
		}
		while (XPending(display)) {
			XNextEvent(display, &Event);
			switch (Event.type) {
			case Expose:
				RedrawWindow();
				break;
			case DestroyNotify:
				XCloseDisplay(display);
				exit(0);
			case ButtonPress:
				n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
				switch (n) {
				case BUT_START:
				case BUT_PAUSE:
				case BUT_STOP:
				case BUT_PREV:
				case BUT_NEXT:
					ButtonDown(n);
					break;
				}
				but_stat = n;
				RedrawWindow();
				break;
			case ButtonRelease:
				n = CheckMouseRegion(Event.xbutton.x, Event.xbutton.y);
				switch (but_stat) {
				case BUT_START:
				case BUT_PAUSE:
				case BUT_STOP:
				case BUT_PREV:
				case BUT_NEXT:
					ButtonUp(but_stat);
					break;
				}
				if (but_stat && n == but_stat) {
					switch (but_stat) {
					case BUT_START:
						running = 1;
						break;
					case BUT_PAUSE:
						running = 0;
						break;
					case BUT_STOP:
						write_log();
						write_record();
						running   = 0;
						sess_time = 0;
						break;
					case BUT_PREV:
						if (!running && sess_time == 0)
							current = current->prev;
						break;
					case BUT_NEXT:
						if (!running && sess_time == 0)
							current = current->next;
						break;
					}
					drawTime(current->time, sess_time, microtm, show_days, running);
					drawProject(current->name);
				}
				RedrawWindow();
				but_stat = 0;
				break;
			}
		}
		usleep(50000L);
		if (do_exit)
			exit(0);
	}
}
Exemplo n.º 9
0
/*shift move set*/
PRIVATE int
shifts(Encoded *Enc, struct_en *str, struct_en *minim){

  int cnt = 0;
  int brack_num = 0;
  short *pt = str->structure;
  int len = pt[0];
  int i, k;

  for (i=1; i<=len; i++) {
    if (pt[i]!=0 && pt[i]>i) {  /*'('*/
      int j=pt[i];

      /* outer switch left*/
      if (Enc->verbose_lvl>1) fprintf(stderr, "%2d bracket %2d position, outer switch left\n", brack_num+1, i);
      for (k=i-1; k>0; k--) {
        if (pt[k]!=0 && pt[k]>k/*'('*/) break;
        if (pt[k]!=0 && pt[k]<k/*')'*/) {
          k = pt[k];
          continue;
        }
        /* checks*/
        if (pt[k]!=0) {
          fprintf(stderr, "WARNING: \'%c\'should be \'.\' at pos %d!\n", pt[k], k);
        }

        /* switch (i,j) to (k,j)*/
        if (j-k>MINGAP && compat(Enc->seq[k-1], Enc->seq[j-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=k;
          Enc->bp_right2=j;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;
        }

        /* switch (i,j) to (k,i)*/
        if (i-k>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=k;
          Enc->bp_right2=i;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;

        }
      }

      /* outer switch right*/
      if (Enc->verbose_lvl>1) fprintf(stderr, "%2d bracket %2d position, outer switch right\n", brack_num+1, i);
      for (k=j+1; k<=len; k++) {
        if (pt[k]!=0 && pt[k]<k/*')'*/) break;
        if (pt[k]!=0 && pt[k]>k/*'('*/) {
          k = pt[k];
          continue;
        }

        /* check*/
        if (pt[k]!=0) {
          fprintf(stderr, "WARNING: \'%c\'should be \'.\' at pos %d!\n", pt[k], k);
        }
        /* switch (i,j) to (i,k)*/
        if (k-i>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=i;
          Enc->bp_right2=k;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;
        }
        /* switch (i,j) to (j,k)*/
        if (k-j>MINGAP && compat(Enc->seq[j-1], Enc->seq[k-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=j;
          Enc->bp_right2=k;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;
        }
      }

      if (Enc->verbose_lvl>1) fprintf(stderr, "%2d bracket %2d position, inner switch\n", brack_num+1, i);
      /* inner switch*/
      for (k=i+1; k<j; k++) {
        /* jump to end of the sub-bracketing*/
        if (pt[k]!=0 && pt[k]>k/*'('*/) {
            k=pt[k];
            continue;
        }

        /* left switch (i,j) to (k,j)*/
        if (j-k>MINGAP && compat(Enc->seq[k-1], Enc->seq[j-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=k;
          Enc->bp_right2=j;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;
        }

        /* right switch (i,j) to (i,k)*/
        if (k-i>MINGAP && compat(Enc->seq[i-1], Enc->seq[k-1])) {
          Enc->bp_left=-i;
          Enc->bp_right=-j;
          Enc->bp_left2=i;
          Enc->bp_right2=k;
          cnt += update_deepest(Enc, str, minim);
          /* in case useFirst is on and structure is found, end*/
          if (Enc->first && cnt > 0) return cnt;
        }
      } /* end inner switch for*/
      brack_num++;
    } /* end if (pt[i]=='(')*/
  } /* end for in switches*/
  return cnt;
}
Exemplo n.º 10
0
/*  try insert base pair (i,j) */
PRIVATE inline bool
try_insert_seq(const char *seq, int i, int j){
  if (i<=0 || j<=0) return false;
  return (j-i>MINGAP && compat(seq[i-1], seq[j-1]));
}
Exemplo n.º 11
0
/* try insert base pair (i,j)*/
PRIVATE inline bool
try_insert(const short *pt, const char *seq, int i, int j){

  if (i<=0 || j<=0 || i>pt[0] || j>pt[0]) return false;
  return (j-i>MINGAP && pt[j]==0 && pt[i]==0 && compat(seq[i-1], seq[j-1]));
}
Exemplo n.º 12
0
/*
 * Reserved/unimplemented system calls in the range 0-150 inclusive
 * are reserved for use in future Berkeley releases.
 * Additional system calls implemented in vendor and other
 * redistributions should be placed in the reserved range at the end
 * of the current calls.
 */
struct sysent sysent[] = {
	0, nosys,			/*   0 = indir or out-of-range */
	1, rexit,			/*   1 = exit */
	0, fork,			/*   2 = fork */
	3, read,			/*   3 = read */
	3, write,			/*   4 = write */
	3, open,			/*   5 = open */
	1, close,			/*   6 = close */
	compat(0,wait),			/*   7 = old wait */
	2, creat,			/*   8 = creat */
	2, link,			/*   9 = link */
	1, unlink,			/*  10 = unlink */
	2, execv,			/*  11 = execv */
	1, chdir,			/*  12 = chdir */
	compat(0,time),			/*  13 = old time */
	3, mknod,			/*  14 = mknod */
	2, chmod,			/*  15 = chmod */
	3, chown,			/*  16 = chown; now 3 args */
	1, obreak,			/*  17 = old break */
	compat(2,stat),			/*  18 = old stat */
	3, lseek,			/*  19 = lseek */
	0, getpid,			/*  20 = getpid */
	3, smount,			/*  21 = mount */
	1, umount,			/*  22 = umount */
Exemplo n.º 13
0
	{ AS(getpeername_args), (sy_call_t *)getpeername, AUE_GETPEERNAME, NULL, 0, 0 },	/* 31 = getpeername */
	{ AS(getsockname_args), (sy_call_t *)getsockname, AUE_GETSOCKNAME, NULL, 0, 0 },	/* 32 = getsockname */
	{ AS(access_args), (sy_call_t *)access, AUE_ACCESS, NULL, 0, 0 },	/* 33 = access */
	{ AS(chflags_args), (sy_call_t *)chflags, AUE_CHFLAGS, NULL, 0, 0 },	/* 34 = chflags */
	{ AS(fchflags_args), (sy_call_t *)fchflags, AUE_FCHFLAGS, NULL, 0, 0 },	/* 35 = fchflags */
	{ 0, (sy_call_t *)sync, AUE_SYNC, NULL, 0, 0 },		/* 36 = sync */
	{ AS(kill_args), (sy_call_t *)kill, AUE_KILL, NULL, 0, 0 },	/* 37 = kill */
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 38 = ostat */
	{ 0, (sy_call_t *)getppid, AUE_GETPPID, NULL, 0, 0 },		/* 39 = getppid */
	{ 0, (sy_call_t *)nosys, AUE_NULL, NULL, 0, 0 },			/* 40 = olstat */
	{ AS(dup_args), (sy_call_t *)dup, AUE_DUP, NULL, 0, 0 },	/* 41 = dup */
	{ 0, (sy_call_t *)pipe, AUE_PIPE, NULL, 0, 0 },		/* 42 = pipe */
	{ 0, (sy_call_t *)getegid, AUE_GETEGID, NULL, 0, 0 },		/* 43 = getegid */
	{ AS(profil_args), (sy_call_t *)profil, AUE_PROFILE, NULL, 0, 0 },	/* 44 = profil */
	{ AS(ktrace_args), (sy_call_t *)ktrace, AUE_KTRACE, NULL, 0, 0 },	/* 45 = ktrace */
	{ compat(AS(ofreebsd32_sigaction_args),freebsd32_sigaction), AUE_SIGACTION, NULL, 0, 0 },	/* 46 = old freebsd32_sigaction */
	{ 0, (sy_call_t *)getgid, AUE_GETGID, NULL, 0, 0 },		/* 47 = getgid */
	{ compat(AS(ofreebsd32_sigprocmask_args),freebsd32_sigprocmask), AUE_SIGPROCMASK, NULL, 0, 0 },	/* 48 = old freebsd32_sigprocmask */
	{ AS(getlogin_args), (sy_call_t *)getlogin, AUE_GETLOGIN, NULL, 0, 0 },	/* 49 = getlogin */
	{ AS(setlogin_args), (sy_call_t *)setlogin, AUE_SETLOGIN, NULL, 0, 0 },	/* 50 = setlogin */
	{ AS(acct_args), (sy_call_t *)acct, AUE_ACCT, NULL, 0, 0 },	/* 51 = acct */
	{ compat(0,freebsd32_sigpending), AUE_SIGPENDING, NULL, 0, 0 },	/* 52 = old freebsd32_sigpending */
	{ AS(freebsd32_sigaltstack_args), (sy_call_t *)freebsd32_sigaltstack, AUE_SIGALTSTACK, NULL, 0, 0 },	/* 53 = freebsd32_sigaltstack */
	{ AS(freebsd32_ioctl_args), (sy_call_t *)freebsd32_ioctl, AUE_NULL, NULL, 0, 0 },	/* 54 = freebsd32_ioctl */
	{ AS(reboot_args), (sy_call_t *)reboot, AUE_REBOOT, NULL, 0, 0 },	/* 55 = reboot */
	{ AS(revoke_args), (sy_call_t *)revoke, AUE_REVOKE, NULL, 0, 0 },	/* 56 = revoke */
	{ AS(symlink_args), (sy_call_t *)symlink, AUE_SYMLINK, NULL, 0, 0 },	/* 57 = symlink */
	{ AS(readlink_args), (sy_call_t *)readlink, AUE_READLINK, NULL, 0, 0 },	/* 58 = readlink */
	{ AS(freebsd32_execve_args), (sy_call_t *)freebsd32_execve, AUE_EXECVE, NULL, 0, 0 },	/* 59 = freebsd32_execve */
	{ AS(umask_args), (sy_call_t *)umask, AUE_UMASK, NULL, 0, 0 },	/* 60 = umask */
	{ AS(chroot_args), (sy_call_t *)chroot, AUE_CHROOT, NULL, 0, 0 },	/* 61 = chroot */
Exemplo n.º 14
0
//shift move set
int shifts(encoded &enc, int &deepest, short *min_pt, degen &deg, bool verbose)
{
  int cnt = 0;
  int brack_num = 0;
  short *pt = enc.pt;
  int len = pt[0];

  for (int i=1; i<=len; i++) {
    if (pt[i]!=0 && pt[i]>i) {  //'('
      int j=pt[i];

      // outer switch left
      if (verbose) fprintf(stderr, "%2d bracket %2d position, outer switch left\n", brack_num+1, i);
      for (int k=i-1; k>0; k--) {
        if (pt[k]!=0 && pt[k]>k/*'('*/) break;
        if (pt[k]!=0 && pt[k]<k/*')'*/) {
          k = pt[k];
          continue;
        }
        // checks
        if (pt[k]!=0) {
          fprintf(stderr, "WARNING: \'%c\'should be \'.\' at pos %d!\n", pt[k], k);
        }

        // switch (i,j) to (k,j)
        if (j-k>MINGAP && compat(enc.seq[k-1], enc.seq[j-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=k;
          enc.bp_right2=j;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;
        }

        // switch (i,j) to (k,i)
        if (i-k>MINGAP && compat(enc.seq[i-1], enc.seq[k-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=k;
          enc.bp_right2=i;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;

        }
      }

      // outer switch right
      if (verbose) fprintf(stderr, "%2d bracket %2d position, outer switch right\n", brack_num+1, i);
      for (int k=j+1; k<=len; k++) {
        if (pt[k]!=0 && pt[k]<k/*')'*/) break;
        if (pt[k]!=0 && pt[k]>k/*'('*/) {
          k = pt[k];
          continue;
        }

        // check
        if (pt[k]!=0) {
          fprintf(stderr, "WARNING: \'%c\'should be \'.\' at pos %d!\n", pt[k], k);
        }
        // switch (i,j) to (i,k)
        if (k-i>MINGAP && compat(enc.seq[i-1], enc.seq[k-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=i;
          enc.bp_right2=k;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;
        }
        // switch (i,j) to (j,k)
        if (k-j>MINGAP && compat(enc.seq[j-1], enc.seq[k-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=j;
          enc.bp_right2=k;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;
        }
      }

      if (verbose) fprintf(stderr, "%2d bracket %2d position, inner switch\n", brack_num+1, i);
      // inner switch
      for (int k=i+1; k<j; k++) {
        // jump to end of the sub-bracketing
        if (pt[k]!=0 && pt[k]>k/*'('*/) {
            k=pt[k];
            continue;
        }

        // left switch (i,j) to (k,j)
        if (j-k>MINGAP && compat(enc.seq[k-1], enc.seq[j-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=k;
          enc.bp_right2=j;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;
        }

        // right switch (i,j) to (i,k)
        if (k-i>MINGAP && compat(enc.seq[i-1], enc.seq[k-1])) {
          enc.bp_left=-i;
          enc.bp_right=-j;
          enc.bp_left2=i;
          enc.bp_right2=k;
          cnt += update_deepest(enc, deepest, min_pt, deg, verbose);
          // in case useFirst is on and structure is found, end
          if (deg.opt->first && cnt > 0) return cnt;
        }
      } // end inner switch for
      brack_num++;
    } // end if (pt[i]=='(')
  } // end for in switches
  return cnt;
}
Exemplo n.º 15
0
struct sysent newssys[] = {
    0, nosys,               /* 0 = nosys indir */
    1, rexit,               /* 1 = exit */
    0, fork,                /* 2 = fork */
    3, read,                /* 3 = read */
    3, write,               /* 4 = write */
    3, open,                /* 5 = open */
    1, close,               /* 6 = close */
    4, wait4,               /* 7 = wait4 */
    2, ocreat,              /* 8 = ocreat */
    2, link,                /* 9 = link */
    1, unlink,              /* 10 = unlink */
    0, nosys,               /* 11 = obsolete execv */
    1, chdir,               /* 12 = chdir */
    compat(1,news_time),    /* 13 = old news_time */
    3, mknod,               /* 14 = mknod */
    2, chmod,               /* 15 = chmod */
    3, chown,               /* 16 = chown */
    1, obreak,              /* 17 = break */
    0, nosys,               /* 18 = obsolete stat */
    3, olseek,              /* 19 = olseek */
    0, getpid,              /* 20 = getpid */
    4, mount,               /* 21 = mount */
    0, nosys,               /* 22 = obsolete umount */
    1, setuid,              /* 23 = setuid */
    0, getuid,              /* 24 = getuid */
    0, nosys,               /* 25 = obsolete stime */
    4, ptrace,              /* 26 = ptrace */
    0, nosys,               /* 27 = obsolete alarm */
    0, nosys,               /* 28 = obsolete fstat */
Exemplo n.º 16
0
	// <
	bool operator<(const _MyIter& right_iter) const
	{
		compat(right_iter);
		return (mCurrentPosition < right_iter.mCurrentPosition);
	}