Ejemplo n.º 1
0
void
compile(Node *n)	/* called from parser only */
{
	extern long autooffset;
	Errjmp x;
	n=constants(n);
	if(cflag){
		fprint(2, "%z:constants:\n");
		dump(n, 0);
	}
	errsave(x);
	if(errmark()){
		autooffset=0;
		resultloc=0;
		breakloc=-1;
		continueloc=-1;
		didbecome=0;
		freenode(n);
		errrest(x);
		errjmp();
	}
	istart();
	gen(n, 0);
	freenode(n);
	errrest(x);
}
Ejemplo n.º 2
0
void
execute(void)
{
	extern int xflag;
	Errjmp s;
	interpreter.fp=0;
	interpreter.sp=interpreter.stack;
	interpreter.pc=prog+1;
	phead=&interpreter;
	ptail=&interpreter;
	interpreter.next=0;
	errsave(s);
	if(errmark()){
		istart();
		errrest(s);
		libgflush();
		errjmp();
	}
    loop:
	if(xflag)
		xxec();
	else
		xec();
	phead=0;
	while(moreio()){
		schedio(1);
		if(phead)
			goto loop;
	}

	if(interpreter.pc[-1]!=idone)
		error("interpreter process blocked");
	errrest(s);
	istart();
	libgflush();
}
Ejemplo n.º 3
0
ErrorCode DenseTag::find_entities_with_value( const SequenceManager* seqman,
                                              Error* error,
                                              Range& output_entities,
                                              const void* value,
                                              int value_bytes,
                                              EntityType type,
                                              const Range* intersect_entities ) const
{
  if (value_bytes && value_bytes != get_size()) {
    error->set_last_error( "Cannot compare data of size %d with tag of size %d",
                           value_bytes, get_size() );
    return MB_INVALID_SIZE;
  }

  if (!intersect_entities) {
    std::pair<EntityType,EntityType> range = type_range(type);
    TypeSequenceManager::const_iterator i;
    for (EntityType t = range.first; t != range.second; ++i) {
      const TypeSequenceManager& map = seqman->entity_map(t);
      for (i = map.begin(); i != map.end(); ++i) {
        const void* data = (*i)->data()->get_tag_data( mySequenceArray );
        if (data) {
          ByteArrayIterator start( (*i)->data()->start_handle(), data, *this );
          ByteArrayIterator end( (*i)->end_handle() + 1, 0, 0 );
          start += (*i)->start_handle() - (*i)->data()->start_handle();
          find_tag_values_equal( *this, value, get_size(), start, end, output_entities );
        }
      }
    }
  }
  else {
    const unsigned char* array = NULL; // initialize to get rid of warning
    size_t count;
    ErrorCode rval;
     
    Range::const_pair_iterator p = intersect_entities->begin();
    if (type != MBMAXTYPE) {
      p = intersect_entities->lower_bound(type);
      assert(TYPE_FROM_HANDLE(p->first) == type);
    }
    for (; 
         p != intersect_entities->const_pair_end() && 
         (MBMAXTYPE == type || TYPE_FROM_HANDLE(p->first) == type); 
         ++p) {

      EntityHandle start = p->first;
      while (start <= p->second) {
        rval = get_array( seqman, error, start, array, count );
        if (MB_SUCCESS != rval)
          return rval; 
        
        if (p->second - start < count-1)
          count = p->second - start + 1;
        
        if (array) {
          ByteArrayIterator istart( start, array, *this );
          ByteArrayIterator iend( start+count, 0, 0 );
          find_tag_values_equal( *this, value, get_size(), istart, iend, output_entities );
        }
        start += count;
      }
    }
  }    
  
  return MB_SUCCESS;
}