Example #1
0
void e_ (wgraph_s *g)
{
  float      weight;
  vertex_s    *v1,
              *v2;
  
  if (GTNEXT()->type == T_OPENBRACE)
  if (GTNEXT()->type == T_ID) {
    v1 = v_lookup (g, stream_->lexeme);
    if (!v1)
      THROW_EXCEPTION();
    if (GTNEXT()->type == T_COMMA)
    if (GTNEXT()->type == T_ID) {
      v2 = v_lookup (g, stream_->lexeme);
      if (!v2)
        THROW_EXCEPTION();
      if (GTNEXT()->type == T_COMMA)
      if (GTNEXT()->type == T_NUM) {
        weight = atof(stream_->lexeme);
        if (GTNEXT()->type == T_CLOSEBRACE) {
          g->nedges++;
          edge_s_ (v1, v2, weight);
          return;
        }
      }
    }
  }
  
exception_:
  printf ("Syntax Error: %s\n", stream_->lexeme);
  exit(EXIT_FAILURE);
}
Example #2
0
void copy_variable( int vset, char *dst, char *src )
{
    int key_target = v_lookup(vset, dst );
    int key_source = v_lookup(vset, src );

    int i = 0;
    char **strp,*s;
    while( m_next( key_source, &i, &strp ) ) {
	s = *strp;
	v_kset( key_target, s, i );
    }
}
Example #3
0
void e_ (wgraph_s *g)
{
    double      weight;
    vertex_s    *v1,
                *v2;
    
    if (GTNEXT()->type == T_OPENBRACE)
    if (GTNEXT()->type == T_ID) {
        v1 = v_lookup (g, stream_->lexeme);
        if (!v1) {
            printf ("Edge: %s does not exist in node set.\n", stream_->lexeme);
            exit(EXIT_FAILURE);
        }
        if (GTNEXT()->type == T_COMMA)
        if (GTNEXT()->type == T_ID) {
            v2 = v_lookup (g, stream_->lexeme);
            if (!v2) {
                printf ("Edge: %s does not exist in node set.\n", stream_->lexeme);
                exit(EXIT_FAILURE);
            }
            if (GTNEXT()->type == T_COMMA)
            if (GTNEXT()->type == T_NUM) {
                weight = atof(stream_->lexeme);
                if (GTNEXT()->type == T_CLOSEBRACE) {
                    g->nedges++;
                    edge_s_ (v1, v2, weight);
                    return;
                }
            }
        }
    }
    
exception_:
    printf ("Syntax Error while parsing an edge (edge #%d): %s\n", g->nedges, stream_->lexeme);
    exit(EXIT_FAILURE);
}
T *
Mem_space::user_to_kernel (T const *addr, bool write)
{
  Phys_addr phys;
  Addr virt = Addr::create((Address) addr);
  unsigned attr, error = 0;
  Size size;

  for (;;)
    {
      // See if there is a mapping for this address
      if (v_lookup (virt, &phys, &size, &attr))
        {
          // Add offset to frame
          phys = phys | virt.offset(size);

          // See if we want to write and are not allowed to
          // Generic check because INTEL_PTE_WRITE == INTEL_PDE_WRITE
          if (!write || (attr & Pt_entry::Writable))
            return (T *) Mem_layout::phys_to_pmem (phys.value());

          error |= PF_ERR_PRESENT;
        }

      if (write)
        error |= PF_ERR_WRITE;

      // If we tried to access user memory of a space other than current_mem_space()
      // our Long-IPC partner must do a page-in. This is analogue to IA32
      // page-faulting in the IPC window. Set PF_ERR_REMTADDR hint.
      // Otherwise we faulted on our own user memory. Set PF_ERR_USERADDR hint.
      error |= (dir() == current_pdir() ? PF_ERR_USERADDR : PF_ERR_REMTADDR);

      // No mapping or insufficient access rights, raise pagefault.
      // Pretend open interrupts, we restore the current state afterwards.
      Cpu_lock::Status was_locked = cpu_lock.test();

      thread_page_fault (virt.value(), error, 0, 
			 Proc::processor_state() | EFLAGS_IF, 0);

      cpu_lock.set (was_locked);
    }
}
Example #5
0
/** speichert eine zuweisung ID=num1,num2,..,num-x in einem varset
 */
int parse_variable_assignment_int(int vset, int line, int *p )
{
    int key, ch;
    int varname = m_create(20,1);

    while(1) {

	if( cut_id( line, p, varname ) < 0 ) break; /* no more vars */
	key = v_lookup(vset, MSTR(varname) ); 
        if( key < 0 ) break;
	v_kclr(key);
	do {
	    if( (ch=cut_id( line, p, varname )) < 0 ) goto leave_err;
	    v_kset(key, MSTR(varname), -1 ); 
	} while( ch == ',' );

    }
    m_free(varname);    
    return 0;

 leave_err:
    m_free(varname);
    return -1;
}