Example #1
0
int findblocks_finallinks2(void)
{
  static str0 v;

  switch(findblocks_finallinks2_state) {
    case 0:
      if (!str0_copy(&v,0,&x)) return -1;
      findblocks_finallinks2_state = 1; return 1;
    case 1:
      if (!str0_copy(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,findblocks_finallinks_writing ? ">" : "<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"=")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&usegraph,0,&key)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"=")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,findblocks_finallinks_writing ? ">" : "<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
  }
  return 0;
}
Example #2
0
int findvars2(void)
{
  switch(findvars2_state) {
    case 0:
      if (!str0_copy(&n,0,&inputfield)) return -1;
      findvars2_state = 1; return 1;
    case 1:
      if (str0_equalc(&inputfield,"label")) { findvars2_state = 10; return 1; }
      if (str0_equalc(&inputfield,"type")) { findvars2_state = 20; return 1; }
      break;
    case 10:
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&n)) return -1;
      if (!critbit0_insert(&labels,0,&key)) return -1;
      break;
    case 20:
      if (!str0_copy(&key,0,&inputfield)) return -1;
      findvars2_state = 21; return 1;
    case 21:
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&inputfield)) return -1;
      if (!critbit0_insert(&vtypes,0,&key)) return -1;
      if (!critbit0_insert(&alltypes,0,&inputfield)) return -1;
      break;
  }
  return 0;
}
Example #3
0
int tracevalue(void)
{
  if (critbit0_contains(&traced,&x)) return 1;
  if (!critbit0_insert(&totrace,0,&x)) return -1;

  for (;;) {
    switch(critbit0_firstprefixed(&totrace,0,&x,&empty)) {
      case 1: critbit0_delete(&totrace,0,&x); break;
      case 0: if (!str0_increment(&value,0)) return -1; return 1;
      default: return -1;
    }
    if (critbit0_contains(&blockvisible,&x))
      if (!critbit0_contains(&blocklive,&x))
	continue;
    if (!critbit0_contains(&traced,&x)) {
      if (!critbit0_insert(&traced,0,&x)) return -1;
      if (!str0_copy(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&value)) return -1;
      if (!critbit0_insert(&values,0,&key)) return -1;
      if (!str0_copy(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (critbit0_allprefixed(&assignusegraph,0,&y,&key,addtotrace) < 1) return -1;
    }
  }
}
Example #4
0
int connectblocks(void)
{
  if (critbit0_contains(&blockbegins,&y)) {
    if (!str0_copy(&key,0,&y)) return -1;
    if (!str0_concatc(&key,0,"=")) return -1;
    if (!str0_concat(&key,0,&tracevar)) return -1;
    if (!critbit0_insert(&totrace,0,&key)) return -1;

    if (!str0_copy(&key,0,&traceinsn)) return -1;
    if (!str0_concatc(&key,0,"=")) return -1;
    if (!str0_concat(&key,0,&tracevar)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (!str0_concat(&key,0,&y)) return -1;
    if (!str0_concatc(&key,0,"=")) return -1;
    if (!str0_concat(&key,0,&tracevar)) return -1;
    if (!critbit0_insert(&assignusegraph,0,&key)) return -1;

    if (!str0_copy(&key,0,&y)) return -1;
    if (!str0_concatc(&key,0,"=")) return -1;
    if (!str0_concat(&key,0,&tracevar)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (!str0_concat(&key,0,&traceinsn)) return -1;
    if (!str0_concatc(&key,0,"=")) return -1;
    if (!str0_concat(&key,0,&tracevar)) return -1;
    if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
  }
  return 1;
}
Example #5
0
int preallocate2(void)
{
  switch(preallocate2_state) {
    case 0:
      if (!str0_copy(&key,0,&reglimitprefix)) return -1;
      if (!str0_concat(&key,0,&y)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      switch(critbit0_firstprefixed(&values,0,&v,&key)) {
        case 1: break;
	case 0: return 0;
	default: return -1;
      }
      preallocate2_state = 1; return 1;
    case 1:
      if (!str0_copy(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&y)) return -1;
      if (critbit0_contains(&avoidregs,&key)) return 0;
      switch(critbit0_insert(&allocated,0,&v)) {
        case 2: break;
        case 1: return 0;
        default: return -1;
      }
      if (!critbit0_insert(&allocations,0,&key)) return -1;
      if (!str0_copy(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_copy(&u,0,&y)) return -1;
      if (critbit0_allprefixed(&conflicts,0,&z,&key,followconflict) < 1) return -1;
      break;
  }
  return 0;
}
Example #6
0
int recordconflict(void)
{
  if (!str0_copy(&key,0,&z)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&y)) return -1;
  if (!critbit0_insert(&conflicts,0,&key)) return -1;
  if (!str0_copy(&key,0,&y)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&z)) return -1;
  if (!critbit0_insert(&conflicts,0,&key)) return -1;
  return 1;
}
Example #7
0
int followconflict(void)
{
  if (!str0_concatc(&z,0,":")) return -1;
  if (!str0_concat(&z,0,&u)) return -1;
  if (!critbit0_insert(&avoidregs,0,&z)) return -1;
  return 1;
}
Example #8
0
int findblocks2(void)
{
  if (critbit0_contains(&blockbegins,&inputfield)) {
    if (!str0_copy(&n,0,&inputfield)) return -1;
    for (;;) {
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":<")) return -1;
      if (critbit0_allprefixed(&uses,0,&v,&key,findblocks_read) < 1) return -1;

      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":kill>")) return -1;
      if (critbit0_allprefixed(&uses,0,&v,&key,findblocks_kill) < 1) return -1;

      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":>")) return -1;
      if (critbit0_allprefixed(&uses,0,&v,&key,findblocks_write) < 1) return -1;

      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_copy(&next,0,&n)) return -1;
      if (!str0_increment(&next,0)) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (critbit0_contains(&blockbegins,&next)) break;
      if (!critbit0_contains(&nextinsn,&key)) break;
      if (!str0_copy(&n,0,&next)) return -1;
    }

    if (!critbit0_insert(&blockends,0,&n)) return -1;
    if (!str0_copy(&key,0,&inputfield)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (!str0_concat(&key,0,&n)) return -1;
    if (!critbit0_insert(&blockleaps,0,&key)) return -1;

    findblocks_finallinks_writing = 1;
    if (!str0_copy(&key,0,&inputfield)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (critbit0_allprefixed(&blockassigned,0,&v,&key,findblocks_finallinks) < 1) nomem();

    findblocks_finallinks_writing = 0;
    if (!str0_copy(&key,0,&inputfield)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (critbit0_allprefixed(&blockread,0,&v,&key,findblocks_finallinks) < 1) nomem();

    return 0;
  }
  return 0;
}
Example #9
0
int recordfloat80(void)
{
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&float80after,0,&key)) return -1;
  return 1;
}
Example #10
0
int findblocks_write(void)
{
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,">")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&assignments,0,&key)) return -1;

  if (findblocks_kill() < 0) return -1;
  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&n)) return -1;
  if (!critbit0_insert(&blockassigned,0,&key)) return -1;

  return 1;
}
Example #11
0
int findexits3(void)
{
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,":<")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&uses,0,&key)) return -1;
  if (!str0_copy(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (critbit0_firstprefixed(&outputregassignments,0,&y,&key) < 1) return -1;
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,"<")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&y)) return -1;
  if (!critbit0_insert(&reglimitok,0,&key)) return -1;
  return 1;
}
Example #12
0
int findentries2(void)
{
  switch(findentries2_state) {
    case 0:
      if (!str0_copy(&n,0,&inputfield)) return -1;
      if (!str0_copy(&next,0,&inputfield)) return -1;
      if (!str0_increment(&next,0)) return -1;
      findentries2_state = 1; return 1;
    case 1:
      if (str0_equalc(&inputfield,"leave")) { findentries2_state = 20; return 1; }
      if (str0_equalc(&inputfield,"goto")) { findentries2_state = 30; return 1; }
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (!critbit0_insert(&nextinsn,0,&key)) return -1;
      if (str0_equalc(&inputfield,"maybegoto")) { findentries2_state = 30; return 1; }
      if (str0_equalc(&inputfield,"enter")) { findentries2_state = 10; return 1; }
      break;
    case 10:
      if (!critbit0_insert(&blockbegins,0,&n)) return -1;
      if (!critbit0_insert(&entries,0,&n)) return -1;
      if (critbit0_allprefixed(&inputregs,0,&v,&empty,findentries3) < 1) nomem();
      break;
    case 20:
      if (!critbit0_insert(&exits,0,&n)) return -1;
      if (critbit0_allprefixed(&outputregs,0,&v,&empty,findexits3) < 1) nomem();
      break;
    case 30:
      if (!critbit0_insert(&blockbegins,0,&next)) return -1;
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      switch(critbit0_firstprefixed(&labels,0,&next,&key)) {
	case 1:
	  break;
	case 0:
	  if (!str0_copyc(&outputline,0,"error:unknown label ")) return -1;
	  if (!str0_concat(&outputline,0,&key)) return -1;
	  if (!str0_concat(&outputline,0,&inputline)) return -1;
	  str0_putline(&outputline);
	  return 0;
	default: 
	  return -1;
      }
      if (!critbit0_insert(&blockbegins,0,&next)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (!critbit0_insert(&nextinsn,0,&key)) return -1;
  }
  return 0;
}
Example #13
0
int main(int argc,char **argv)
{
  for (;;)
    switch(str0_getline(&inputline,0)) {
      case 1: case 2:
	if (!str0_uint64(&key,0,inputlinesnum)) nomem();
	if (!str0_concatc(&key,0,":")) nomem();
	if (!str0_concat(&key,0,&inputline)) nomem();
        if (!critbit0_insert(&inputlines,0,&key)) nomem();
	++inputlinesnum;
        break;
      case 0:
	doit();
	return 0;
      default:
	return 111; /* XXX: louder? */
    }
}
Example #14
0
int findblocks_kill(void)
{
  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,"=")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&blockkilled,0,&key)) return -1;

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  switch(critbit0_firstprefixed(&blockassigned,0,&x,&key)) {
    case 1:
      if (!str0_concat(&key,0,&x)) return -1;
      critbit0_delete(&blockassigned,0,&key);
      break;
    case 0:
      break;
    default:
      return -1;
  }

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  switch(critbit0_firstprefixed(&blockread,0,&x,&key)) {
    case 1:
      if (!str0_concat(&key,0,&x)) return -1;
      critbit0_delete(&blockread,0,&key);
      break;
    case 0:
      break;
    default:
      return -1;
  }
  return 1;
}
Example #15
0
int finduses_reglimit(int alpha)
{
  switch(finduses_reglimit_state) {
    case 0:
      if (!str0_equalc(&inputword,"=")) return 0;
      finduses_reglimit_state = 1; return 1;
    case 1:
      if (!str0_copy(&type,0,&inputword)) return -1;
      finduses_reglimit_state = 2; return 1;
    case 2:
      if (!str0_equalc(&inputword,"#")) return 0;
      finduses_reglimit_state = 3; return 1;
    case 3:
      if (!str0_copy(&key,0,&reglimit)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&type)) return -1;
      if (!str0_concatc(&key,0,"#")) return -1;
      if (!str0_concat(&key,0,&inputword)) return -1;
      if (!critbit0_insert(&reglimitok,0,&key)) return -1;
      break;
  }
  return 0;
}
Example #16
0
int finduses2(void)
{
  switch(finduses2_state) {
    case 0:
      if (!str0_copy(&n,0,&inputfield)) return -1;
      finduses2_state = 1; return 1;
    case 1:
      if (str0_equalc(&inputfield,"inputreg")) { finduses2_state = 10; return 1; }
      if (str0_equalc(&inputfield,"outputreg")) { finduses2_state = 20; return 1; }
      if (str0_equalc(&inputfield,"kill")) { finduses2_state = 30; return 1; }
      if (str0_equalc(&inputfield,"reglimit")) { finduses2_state = 40; return 1; }
      if (str0_equalc(&inputfield,"op")) { finduses2_state = 50; return 1; }
      if (str0_equalc(&inputfield,"maybegoto")) { finduses2_state = 50; return 1; }
      break;
    case 10:
      if (!critbit0_insert(&inputregs,0,&inputfield)) return -1;
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!critbit0_firstprefixed(&vtypes,0,&type,&key)) {
	if (!str0_copyc(&outputline,0,"error:unknown variable ")) return -1;
	if (!str0_concat(&outputline,0,&key)) return -1;
	if (!str0_concat(&outputline,0,&inputline)) return -1;
	str0_putline(&outputline);
	return 0;
      }
      finduses2_state = 11; return 1;
    case 11:
      if (!str0_copy(&x,0,&key)) return -1;
      if (!str0_concat(&x,0,&inputfield)) return -1;
      if (!critbit0_insert(&inputregassignments,0,&x)) return -1;
      break;
    case 20:
      if (!critbit0_insert(&outputregs,0,&inputfield)) return -1;
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!critbit0_firstprefixed(&vtypes,0,&type,&key)) {
	if (!str0_copyc(&outputline,0,"error:unknown variable ")) return -1;
	if (!str0_concat(&outputline,0,&key)) return -1;
	if (!str0_concat(&outputline,0,&inputline)) return -1;
	str0_putline(&outputline);
	return 0;
      }
      finduses2_state = 21; return 1;
    case 21:
      if (!str0_copy(&x,0,&key)) return -1;
      if (!str0_concat(&x,0,&inputfield)) return -1;
      if (!critbit0_insert(&outputregassignments,0,&x)) return -1;
      break;
    case 30:
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!critbit0_firstprefixed(&vtypes,0,&type,&key)) {
	if (!str0_copyc(&outputline,0,"error:unknown variable ")) return -1;
	if (!str0_concat(&outputline,0,&key)) return -1;
	if (!str0_concat(&outputline,0,&inputline)) return -1;
	str0_putline(&outputline);
      }
      break;
    case 40:
      if (!str0_copy(&key,0,&inputfield)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!critbit0_firstprefixed(&vtypes,0,&type,&key)) {
	if (!str0_copyc(&outputline,0,"error:unknown variable ")) return -1;
	if (!str0_concat(&outputline,0,&key)) return -1;
	if (!str0_concat(&outputline,0,&inputline)) return -1;
	str0_putline(&outputline);
	return 0;
      }
      if (!str0_copy(&reglimit,0,&n)) return -1;
      if (!str0_concatc(&reglimit,0,"<")) return -1;
      if (!str0_concat(&reglimit,0,&inputfield)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":<")) return -1;
      if (!str0_concat(&key,0,&inputfield)) return -1;
      if (!critbit0_insert(&uses,0,&key)) return -1;
      finduses2_state = 41; return 1;
    case 41:
      finduses_reglimit_state = 0;
      if (str0_word(&inputword,0,&inputfield,finduses_reglimit) < 0) return -1;
      return 1;
    case 50:
      finduses2_state = 51; return 1;
    case 51:
      if (str0_length(&inputfield) > 0) {
        if (!str0_copy(&key,0,&n)) return -1;
        if (!str0_concatc(&key,0,":")) return -1;
        if (!str0_concat(&key,0,&inputfield)) return -1;
        if (!critbit0_insert(&uses,0,&key)) return -1;
      }
      return 1;
  }
  return 0;
}
Example #17
0
int traceassignment(void)
{
  int flagstarting;

  critbit0_clear(&traced,0);
  critbit0_clear(&totrace,0);
  if (!critbit0_insert(&totrace,0,&v)) return -1;

  for (flagstarting = 1;;flagstarting = 0) {
    switch(critbit0_firstprefixed(&totrace,0,&x,&empty)) {
      case 1:
	break;
      case 0:
	if (traceassignment_state == 1) {
	  if (!critbit0_insert(&finalreads,0,&v)) return -1;
	}
        return 1;
      default:
	return -1;
    }
    critbit0_delete(&totrace,0,&x);


    if (traceassignment_state == 1)
      if (!flagstarting)
        if (str0_equal(&v,&x))
	  return 1;

    switch(critbit0_insert(&traced,0,&x)) {
      case 2: break;
      case 1: continue;
      default: return -1;
    }

    traceword_state = 0;
    switch(str0_word(&y,0,&x,traceword)) {
      case 1:
	if (str0_equalc(&tracestatus,"<")) {
	  if (traceassignment_state == 2) {
	    if (!critbit0_insert(&blocklive,0,&v)) return -1;
	    return 1;
	  }
	  if (traceassignment_state == 1) {
	    if (!flagstarting) {
	      return 1;
	    }
	    break;
	  }
	  if (!str0_copy(&key,0,&v)) return -1;
	  if (!str0_concatc(&key,0,":")) return -1;
	  if (!str0_concat(&key,0,&x)) return -1;
	  if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
	  if (!str0_copy(&key,0,&x)) return -1;
	  if (!str0_concatc(&key,0,":")) return -1;
	  if (!str0_concat(&key,0,&v)) return -1;
	  if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
	} else if (str0_equalc(&tracestatus,"=")) {
	  if (critbit0_contains(&blockends,&traceinsn)) {
	    if (!str0_copy(&key,0,&traceinsn)) return -1;
	    if (!str0_concatc(&key,0,":")) return -1;
            if (critbit0_allprefixed(&nextinsn,0,&y,&key,connectblocks) < 1) return -1;
	  }
	  if (critbit0_contains(&blockbegins,&traceinsn)) {
	    if (!str0_copy(&key,0,&traceinsn)) return -1;
	    if (!str0_concatc(&key,0,":")) return -1;
	    if (!str0_concat(&key,0,&tracevar)) return -1;
	    if (!str0_copy(&key,0,&traceinsn)) return -1;
	    if (!str0_concatc(&key,0,"=")) return -1;
	    if (!str0_concat(&key,0,&tracevar)) return -1;
	    if (!critbit0_insert(&blockvisible,0,&key)) return -1;
	    if (!critbit0_contains(&blockkilled,&key)) {
	      if (!str0_copy(&key,0,&traceinsn)) return -1;
	      if (!str0_concatc(&key,0,":")) return -1;
	      switch(critbit0_firstprefixed(&blockleaps,0,&next,&key)) {
	        case 0:
		  break;
	        case 1:
	          if (!str0_copy(&key,0,&next)) return -1;
	          if (!str0_concatc(&key,0,"=")) return -1;
	          if (!str0_concat(&key,0,&tracevar)) return -1;
                  if (!critbit0_insert(&totrace,0,&key)) return -1;
	          if (!str0_copy(&key,0,&traceinsn)) return -1;
	          if (!str0_concatc(&key,0,"=")) return -1;
	          if (!str0_concat(&key,0,&tracevar)) return -1;
	          if (!str0_concatc(&key,0,":")) return -1;
	          if (!str0_concat(&key,0,&next)) return -1;
	          if (!str0_concatc(&key,0,"=")) return -1;
	          if (!str0_concat(&key,0,&tracevar)) return -1;
	          if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
	          if (!str0_copy(&key,0,&next)) return -1;
	          if (!str0_concatc(&key,0,"=")) return -1;
	          if (!str0_concat(&key,0,&tracevar)) return -1;
	          if (!str0_concatc(&key,0,":")) return -1;
	          if (!str0_concat(&key,0,&traceinsn)) return -1;
	          if (!str0_concatc(&key,0,"=")) return -1;
	          if (!str0_concat(&key,0,&tracevar)) return -1;
	          if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
		  break;
	        default:
		  return -1;
	      }
	    }
	  }
	}
	break;
      case 0:
	break;
      default:
	return -1;
    }

    if (!str0_concatc(&x,0,":")) return -1;
    if (critbit0_allprefixed(&usegraph,0,&y,&x,addtotrace) < 1) return -1;
  }
}
Example #18
0
int addtotrace(void)
{
  if (!critbit0_insert(&totrace,0,&y)) return -1;
  return 1;
}
Example #19
0
int allocate_alive(void)
{
  if (!str0_copy(&key,0,&x)) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (critbit0_firstprefixed(&values,0,&y,&key) < 1) return -1;
  if (critbit0_contains(&livevalues,&y)) return 1;

  if (!str0_copy(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (critbit0_firstprefixed(&vtypes,0,&type,&key) < 1) return -1;

  if (str0_equalc(&type,"flags")) return 1; /* XXX */

  if (allocate_state == 1) {
    if (!str0_copy(&key,0,&type)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (critbit0_allprefixed(&livevaluetypes,0,&z,&key,recordconflict) < 1) return -1;
  }

  if (!critbit0_insert(&livevalues,0,&y)) return -1;

  if (!str0_copy(&key,0,&type)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&y)) return -1;
  if (!critbit0_insert(&livevaluetypes,0,&key)) return -1;

  if (allocate_state == 2) {
    switch(critbit0_insert(&allocated,0,&y)) {
      case 2:
	break;
      case 1:
	if (!str0_copy(&key,0,&y)) return -1;
	if (!str0_concatc(&key,0,":")) return -1;
	if (critbit0_firstprefixed(&allocations,0,&z,&key) < 1) return -1;
	if (critbit0_contains(&liveregs,&z)) {
	  if (!str0_copyc(&outputline,0,"error:internal register misassignment:")) return -1;
	  if (!str0_concat(&outputline,0,&z)) return -1;
	  str0_putline(&outputline);
	}
	if (!critbit0_insert(&liveregs,0,&z)) return -1;
	if (str0_equalc(&type,"float80")) {
	  if (!str0_copy(&key,0,&v)) return -1;
	  if (!str0_concatc(&key,0,"#")) return -1;
	  if (!str0_concat(&key,0,&y)) return -1;
	  if (!str0_concatc(&key,0,"=")) return -1;
	  if (!str0_concat(&key,0,&z)) return -1;
	  if (!critbit0_insert(&livefloat80regs,0,&key)) return -1;
	}
	return 1;
      default:
	return -1;
    }
    if (!str0_copyc(&r,0,"1")) return -1;
    for (;;) {
      if (!str0_copy(&key,0,&type)) return -1;
      if (!str0_concatc(&key,0,"#")) return -1;
      if (!str0_concat(&key,0,&r)) return -1;
      if (!critbit0_contains(&liveregs,&key)) {
        if (!str0_copy(&key,0,&y)) return -1;
        if (!str0_concatc(&key,0,":")) return -1;
        if (!str0_concat(&key,0,&type)) return -1;
        if (!str0_concatc(&key,0,"#")) return -1;
        if (!str0_concat(&key,0,&r)) return -1;
        if (!critbit0_contains(&avoidregs,&key)) break;
      }
      if (!str0_increment(&r,0)) return -1;
    }
    if (!str0_copy(&key,0,&type)) return -1;
    if (!str0_concatc(&key,0,"#")) return -1;
    if (!str0_concat(&key,0,&r)) return -1;
    if (!critbit0_insert(&liveregs,0,&key)) return -1;
    if (str0_equalc(&type,"float80")) {
      if (!str0_copy(&z,0,&v)) return -1;
      if (!str0_concatc(&z,0,"#")) return -1;
      if (!str0_concat(&z,0,&y)) return -1;
      if (!str0_concatc(&z,0,"=")) return -1;
      if (!str0_concat(&z,0,&key)) return -1;
      if (!critbit0_insert(&livefloat80regs,0,&z)) return -1;
    }
    if (!str0_copy(&key,0,&y)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (!str0_concat(&key,0,&type)) return -1;
    if (!str0_concatc(&key,0,"#")) return -1;
    if (!str0_concat(&key,0,&r)) return -1;
    if (!critbit0_insert(&allocations,0,&key)) return -1;
    if (!str0_copy(&key,0,&y)) return -1;
    if (!str0_concatc(&key,0,":")) return -1;
    if (!str0_copy(&u,0,&type)) return -1;
    if (!str0_concatc(&u,0,"#")) return -1;
    if (!str0_concat(&u,0,&r)) return -1;
    if (critbit0_allprefixed(&conflicts,0,&z,&key,followconflict) < 1) return -1;
    return 1;
  }

  return 1;
}
Example #20
0
int findblocks_read(void)
{
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,"<")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&reads,0,&key)) return -1;

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  switch(critbit0_firstprefixed(&blockread,0,&x,&key)) {
    case 1:
      if (!str0_concat(&key,0,&x)) return -1;
      critbit0_delete(&blockread,0,&key);
      if (!str0_copy(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&usegraph,0,&key)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
      break;
    case 0:
      break;
    default:
      return -1;
  }
  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&n)) return -1;
  if (!critbit0_insert(&blockread,0,&key)) return -1;

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  switch(critbit0_firstprefixed(&blockassigned,0,&x,&key)) {
    case 1:
      if (!str0_copy(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,">")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&usegraph,0,&key)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,"<")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&x)) return -1;
      if (!str0_concatc(&key,0,">")) return -1;
      if (!str0_concat(&key,0,&v)) return -1;
      if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
      return 1;
    case 0:
      break;
    default:
      return -1;
  }

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,"=")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (critbit0_contains(&blockkilled,&key)) {
    if (!str0_copyc(&outputline,0,"error:reading dead variable ")) return -1;
    if (!str0_concat(&outputline,0,&v)) return -1;
    if (!str0_concatc(&outputline,0,":")) return -1;
    if (!str0_concat(&outputline,0,&inputline)) return -1;
    str0_putline(&outputline);
    return 1;
  }

  if (!str0_copy(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,"=")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,"<")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&usegraph,0,&key)) return -1;
  if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
  if (!str0_copy(&key,0,&n)) return -1;
  if (!str0_concatc(&key,0,"<")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!str0_concatc(&key,0,":")) return -1;
  if (!str0_concat(&key,0,&inputfield)) return -1;
  if (!str0_concatc(&key,0,"=")) return -1;
  if (!str0_concat(&key,0,&v)) return -1;
  if (!critbit0_insert(&assignusegraph,0,&key)) return -1;
  return 1;
}
Example #21
0
int main(int argc,char* argv[]) {
  static critbit0_tree t;
  assert(critbit0_insert(&t,"fnord")==2);
  assert(critbit0_insert(&t,"fnord2")==2);
  assert(critbit0_insert(&t,"fnord2")==1);
  assert(critbit0_contains(&t,"foo")==0);
  assert(critbit0_contains(&t,"fnord")==1);
  assert(critbit0_allprefixed(&t,"fnord",ret1,NULL)==1);
  assert(critbit0_allprefixed(&t,"fnord",ret0,NULL)==0);
  assert(critbit0_delete(&t,"fnord2")==1);
  assert(critbit0_delete(&t,"foo")==0);
#if 0
  int s = socket_tcp6();
#endif
#if 0
  iarray i;
  iarray_init(&i,sizeof(size_t));
  printf("%p\n",iarray_get(&i,0));
  printf("%p\n",iarray_allocate(&i,0));
  printf("%p\n",iarray_allocate(&i,0));
  printf("%p\n",iarray_get(&i,0));
#endif
#if 0
  char buf[1024];
  size_t l;
  unsigned char c;
  (void)writecb;
  printf("%d\n",(c=scan_fromhex('.')));
  (void)argc;
  (void)argv;
  assert(fmt_jsonescape(buf,"foo\nbar\\",8)==14 && byte_equal(buf,14,"foo\\u000abar\\\\"));
  memset(buf,0,sizeof(buf));
  assert(scan_jsonescape("foo\\u000abar\\\\",buf,&l)==14 && l==8 && byte_equal(buf,8,"foo\nbar\\"));
  memset(buf,0,sizeof(buf));
  /* example from the json spec: G clef U+1D11E encoded using UTF-16 surrogates*/
  assert(scan_jsonescape("\\uD834\\uDD1Exyz",buf,&l)==15 && l==7 && byte_equal(buf,7,"\xf4\x8d\x84\x9exyz"));

/*
	 1D11E -> 0001 1101 0001 0001 1110
	       -> ______00 __011101 __000100 __011110
	 as utf8: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
	          11110000 10011101 10000100 10011110
		  f   0    9   d    8   4    9   e
*/

#endif
#if 0
  static size_t x;
  x=23;
  atomic_add(&x,3);
  printf("%u\n",x);
  printf("%u\n",atomic_add_return(&x,-3));
  printf("%u\n",compare_and_swap(&x,26,17));
  printf("%u\n",compare_and_swap(&x,23,17));
#endif

#if 0
  atomic_add(&x,3); printf("%u\n",x);
  x=23;
  atomic_add(&x,3); assert(x==26);
  atomic_or(&x,1); assert(x==27);
  atomic_and(&x,-2); assert(x==26);
#endif

#if 0
  iarray a;
  char* c;
  iarray_init(&a,sizeof(io_entry));
  printf("15 -> %p\n",c=iarray_allocate(&a,15));
  printf("23 -> %p\n",c=iarray_allocate(&a,23));
  printf("1234567 -> %p\n",c=iarray_allocate(&a,1234567));
  printf("23 -> %p\n",iarray_get(&a,23));
#endif
#if 0
  io_batch* b=iob_new(1234);
  int64 fd=open("t.c",0);
  iob_addbuf(b,"fnord",5);
  iob_addfile_close(b,fd,0,7365);
  iob_write(1,b,writecb);
#endif
#if 0
  char dest[1024];
  unsigned long len;
  scan_urlencoded2("libstdc++.tar.gz",dest,&len);
  buffer_putmflush(buffer_1,dest,"\n");
#endif
#if 0
  static stralloc sa;
  stralloc_copym(&sa,"foo ","bar ","baz.\n");
  write(1,sa.s,sa.len);
#endif
#if 0
  buffer_putmflush(buffer_1,"foo ","bar ","baz.\n");
#endif
#if 0
  char* c="fnord";
  int fd=open_read(c);
  errmsg_iam(argv[0]);
  carp("could not open file `",c,"'");
  diesys(23,"could not open file `",c,"'");
#endif
#if 0
  errmsg_warn("could not open file `",c,"'",0);
  errmsg_warnsys("could not open file `",c,"'",0);
#endif
#if 0
  char buf[100]="/usr/bin/sh";
  int len=str_len(buf);
  assert(byte_rchr(buf,len,'/')==8);
  assert(byte_rchr(buf,len,'@')==len);
  assert(byte_rchr(buf,len,'h')==len-1);
  printf("%d\n",byte_rchr("x",1,'x'));
#endif
#if 0
  char buf[IP6_FMT+100];
  int i;
  char ip[16];
  uint32 scope_id;
  char* s="fec0::1:220:e0ff:fe69:ad92%eth0/64";
  char blubip[16]="\0\0\0\0\0\0\0\0\0\0\xff\xff\x7f\0\0\001";
  i=scan_ip6if(s,ip,&scope_id);
  assert(s[i]=='/');
  buffer_put(buffer_1,buf,fmt_ip6if(buf,ip,scope_id));
  buffer_putnlflush(buffer_1);
  buffer_put(buffer_1,buf,fmt_ip6ifc(buf,blubip,scope_id));
  buffer_putnlflush(buffer_1);
  scan_ip6("2001:7d0:0:f015:0:0:0:1",ip);
  buffer_put(buffer_1,buf,fmt_ip6(buf,ip));
  buffer_putnlflush(buffer_1);
#endif
#if 0
  char buf[100];
  int i;
  printf("%d\n",i=fmt_pad(buf,"fnord",5,7,10));
  buf[i]=0;
  puts(buf);
#endif
#if 0
  char ip[16];
  char buf[32];
  printf("%d (expect 2)\n",scan_ip6("::",ip));
  printf("%d (expect 3)\n",scan_ip6("::1",ip));
  printf("%d (expect 16)\n",scan_ip6("fec0:0:0:ffff::1/0",ip));
  printf("%.*s\n",fmt_ip6(buf,ip),buf);
#endif
#if 0
  static stralloc s,t;
  stralloc_copys(&s,"fnord");
  stralloc_copys(&t,"abc"); printf("%d\n",stralloc_diff(&s,&t));
  stralloc_copys(&t,"fnor"); printf("%d\n",stralloc_diff(&s,&t));
  stralloc_copys(&t,"fnord"); printf("%d\n",stralloc_diff(&s,&t));
  stralloc_copys(&t,"fnordh"); printf("%d\n",stralloc_diff(&s,&t));
  stralloc_copys(&t,"hausen"); printf("%d\n",stralloc_diff(&s,&t));
#endif
#if 0
  static stralloc s;
  stralloc_copys(&s,"fnord");
  printf("%d\n",stralloc_diffs(&s,"abc"));
  printf("%d\n",stralloc_diffs(&s,"fnor"));
  printf("%d\n",stralloc_diffs(&s,"fnord"));
  printf("%d\n",stralloc_diffs(&s,"fnordh"));
  printf("%d\n",stralloc_diffs(&s,"hausen"));
#endif
#if 0
  printf("%d\n",case_starts("fnordhausen","FnOrD"));
  printf("%d\n",case_starts("fnordhausen","blah"));
#endif
#if 0
  char buf[]="FnOrD";
  case_lowers(buf);
  puts(buf);
#endif
#if 0
  char buf[100]="foo bar baz";
  printf("%d (expect 7)\n",byte_rchr(buf,11,' '));
#endif
#if 0
  unsigned long size;
  char* buf=mmap_read(argv[1],&size);
  if (buf) {
    unsigned int x=fmt_yenc(0,buf,size);
    unsigned int y;
    char* tmp=malloc(x+1);
    y=fmt_yenc(tmp,buf,size);
    write(1,tmp,x);
  }
#endif
#if 0
  char buf[100];
  char buf2[100];
  unsigned int len,len2;
  buf[fmt_yenc(buf,"http://localhost/~fefe",22)]=0;
  buffer_puts(buffer_1,buf);
  buffer_putsflush(buffer_1,"\n");
  if ((buf[len2=scan_yenc(buf,buf2,&len)])!='\n') {
    buffer_putsflush(buffer_2,"parse error!\n");
    return 1;
  }
  buffer_put(buffer_1,buf2,len2);
  buffer_putsflush(buffer_1,"\n");
  return 0;
#endif
#if 0
  char buf[100];
  char buf2[100];
  unsigned int len,len2;
  buf[fmt_base64(buf,"foo:bar",7)]=0;
  buffer_puts(buffer_1,buf);
  buffer_putsflush(buffer_1,"\n");
  if ((buf[len2=scan_base64(buf,buf2,&len)])!=0) {
    buffer_putsflush(buffer_2,"parse error!\n");
    return 1;
  }
  buffer_put(buffer_1,buf2,len2);
  buffer_putsflush(buffer_1,"\n");
  return 0;
#endif
#if 0
  unsigned long size;
  char* buf=mmap_read(argv[1],&size);
  if (buf) {
    unsigned int x=fmt_uuencoded(0,buf,size);
    unsigned int y;
    char* tmp=malloc(x+1);
    y=fmt_uuencoded(tmp,buf,size);
    write(1,tmp,x);
  }
#endif
#if 0
  char buf[]="00000000000000000000000000000001";
  char ip[16];
  if (scan_ip6_flat(buf,ip) != str_len(buf))
    buffer_putsflush(buffer_2,"parse error!\n");
#endif
#if 0
  int fd=open_read("t.c");
  buffer b;
  char buf[1024];
  char line[20];
  int i;
  buffer_init(&b,read,fd,buf,1024);
  i=buffer_getline(&b,line,19);
  buffer_puts(buffer_1,"getline returned ");
  buffer_putulong(buffer_1,i);
  buffer_puts(buffer_1,"\n");
  buffer_puts(buffer_1,line);
  buffer_flush(buffer_1);
#endif
#if 0
  buffer_putulong(buffer_1,23);
//  buffer_putspace(buffer_1);
  buffer_putsflush(buffer_1,"\n");
//  buffer_flush(buffer_1);
#endif
#if 0
  long a,b,c;
  char buf[4096];
  char buf2[4096];
  memcpy(buf,buf2,4096);
  byte_copy(buf,4096,buf2);
  rdtscl(a);
  memcpy(buf,buf2,4096);
  rdtscl(b);
  byte_copy(buf,4096,buf2);
  rdtscl(c);
  printf("memcpy: %d - byte_copy: %d\n",b-a,c-b);
#endif
#if 0
  char ip[16];
  int i;
  if ((i=scan_ip6(argv[1],ip))) {
    char buf[128];
    buf[fmt_ip6(buf,ip)]=0;
    puts(buf);
  }
#endif
#if 0
  char buf[100];
  strcpy(buf,"foobarbaz");
  buf[fmt_fill(buf,3,5,100)]=0;
  printf("\"%s\"\n",buf);
#endif
#if 0
  unsigned long len;
  char *c=mmap_read("/etc/passwd",&len);
  printf("got map %p of len %lu\n",c,len);
#endif
#if 0
  char c;
  printf("%d\n",buffer_getc(buffer_0,&c));
  printf("%c\n",c);
#endif
#if 0
  char buf[100]="01234567890123456789012345678901234567890123456789";
  long a,b,c;
#endif
#if 0
  buf[ip4_fmt(buf,ip4loopback)]=0;
  buffer_puts(buffer_1small,buf);
  buffer_flush(buffer_1small);
#endif

#if 0
  buf[0]=0;
  buf[fmt_8long(buf,0)]=0;
  puts(buf);
  rdtscl(a);
  c=str_len(buf);
  rdtscl(b);
  /*byte_zero_djb(buf,j); */
//  printf("\n%lu %d\n",b-a,c);
#endif
#if 0
  buffer_puts(buffer_1small,"hello, world\n");
  buffer_flush(buffer_1small);
#endif
#if 0
  int s=socket_tcp4();
  char ip[4]={127,0,0,1};
  int t=socket_connect4(s,ip,80);
#endif
#if 0
  char buf[100]="foo bar baz fnord   ";
  char buf2[100]="foo braz fnord";
  long a,b,c;
  long i=0,j=0,k=0;
  double d;
  uint32 l,m,n;
  stralloc sa={0};
  stralloc_copys(&sa,"fnord");
  stralloc_catlong0(&sa,-23,5);
  stralloc_append(&sa,"\n");
  printf("%d %d\n",str_equal("fnord","fnord1"),str_equal("fnord1","fnord"));
  write(1,sa.s,sa.len);
  printf("%d %d\n",stralloc_starts(&sa,"fnord"),stralloc_starts(&sa,"fnord\na"));

  l=0xdeadbeef;
  uint32_pack_big((char*)&m,l);
  uint32_unpack_big((char*)&m,&n);
  printf("%x %x %x\n",l,m,n);

  rdtscl(a);
/*  i=scan_double("3.1415",&d); */
  rdtscl(b);
  /*byte_zero_djb(buf,j); */
  rdtscl(c);
  printf("%lu %lu\n",b-a,c-b);
#endif
#if 0
  size_t size;
  char* buf=mmap_read(argv[1],&size);
  if (buf) {
    unsigned int x=fmt_urlencoded2(0,buf,size,"x");
    unsigned int y;
    char* tmp=malloc(x+1);
    y=fmt_urlencoded2(tmp,buf,size,"x");
    write(1,tmp,x);
  }
#endif
#if 0
  printf("%d %d\n",strcmp("foo","bar"),str_diff("foo","bar"));
  printf("%d %d\n",strcmp("foo","\xfcar"),str_diff("foo","\xfcar"));
#endif
#if 0
  {
    int16 a;
    int32 b;
    int64 c;
    assert(imult16(4,10000,&a)==0);
    assert(imult16(-4,10000,&a)==0);
    assert(imult16(5,10,&a)==1 && a==50);
    assert(imult16(-3,10000,&a)==1 && a==-30000);

    assert(imult32(0x40000000,2,&b)==0);
    assert(imult32(0x3fffffff,2,&b)==1 && b==0x7ffffffe);

    assert(imult64(0x4000000000000000ll,2,&c)==0);
    assert(imult64(0x3fffffffffffffffll,2,&c)==1 && c==0x7ffffffffffffffell);
  }
#endif
#if 0
  stralloc a;
  printf("%d\n",stralloc_copym(&a,"fnord",", ","foo"));
#endif

  return 0;
}
Example #22
0
int allocate(void)
{
  if (critbit0_contains(&traced,&n)) {
    if (!str0_copyc(&outputline,0,"error:falling through entry:")) return -1;
    if (!str0_concat(&outputline,0,&n)) return -1;
    str0_putline(&outputline);
    return 1;
  }

  for (;;) {
    if (!critbit0_contains(&traced,&n)) {
      if (!critbit0_insert(&traced,0,&n)) return -1;

      if (critbit0_contains(&blockbegins,&n)) {
	critbit0_clear(&livevalues,0);
	critbit0_clear(&livevaluetypes,0);
	critbit0_clear(&liveregs,0);
	critbit0_clear(&livefloat80regs,0);
      }

      if (!str0_copy(&x,0,&n)) return -1;
      if (!str0_concatc(&x,0,"=")) return -1;
      if (critbit0_allprefixed(&blocklive,0,&v,&x,allocate_alive) < 0) return -1;

      if (!str0_copy(&x,0,&n)) return -1;
      if (!str0_concatc(&x,0,"<")) return -1;
      if (critbit0_allprefixed(&reads,0,&v,&x,allocate_alive) < 0) return -1;

      if (!str0_copy(&x,0,&n)) return -1;
      if (!str0_concatc(&x,0,"<")) return -1;
      if (critbit0_allprefixed(&finalreads,0,&v,&x,allocate_dead) < 0) return -1;

      if (!str0_copy(&x,0,&n)) return -1;
      if (!str0_concatc(&x,0,">")) return -1;
      if (critbit0_allprefixed(&assignments,0,&v,&x,allocate_alive) < 0) return -1;

      if (critbit0_allprefixed(&livefloat80regs,0,&v,&empty,recordfloat80) < 0) return -1;

      if (!str0_copy(&next,0,&n)) return -1;
      if (!str0_increment(&next,0)) return -1;
  
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (critbit0_allprefixed(&nextinsn,0,&y,&key,addtotrace) < 0) return -1;
  
      if (!str0_copy(&key,0,&n)) return -1;
      if (!str0_concatc(&key,0,":")) return -1;
      if (!str0_concat(&key,0,&next)) return -1;
      if (critbit0_contains(&nextinsn,&key)) {
        if (!str0_copy(&n,0,&next)) return -1;
        continue;
      }
    }

    switch(critbit0_firstprefixed(&totrace,0,&n,&empty)) {
      case 1: break;
      case 0: return 1;
      default: return -1;
    }
    critbit0_delete(&totrace,0,&n);
  }
}