Exemple #1
0
void _show(value_t p, FILE* stream) {
    if (IS_FIXNUM(p)) {
        fprintf(stream, "%ld", VALUE_TO_FIXNUM(p));
    } else if (IS_PAIR(p)) {
        pair_t pair = VALUE_TO_PAIR(p);
        fprintf(stream, "(");
        _show(pair.first, stream);
        fprintf(stream, " ");
        _show(pair.second, stream);
        fprintf(stream, ")");
    } else if (IS_CLOSURE(p)) {
        fprintf(stream, "#<closure 0x%08lx>", p);
    } else if (IS_IMMEDIATE(p)) {
        if (p == BOOL_F) {
            fprintf(stream, "#f");
        } else if (p == BOOL_T) {
            fprintf(stream, "#t");
        } else if (p == NIL) {
            fprintf(stream, "()");
        } else {
            fprintf(stream, "#<immediate 0x%08lx>", p);
        }
    } else {
        fprintf(stream, "#<unknown 0x%08lx>", p);
    }
}
Exemple #2
0
Event_p get_new_event(int  tr)
 {/* Init get_new_event */
  int i;
  Event_p ptr;

#ifdef SIMULATION
#ifndef SYMBOLIC
#ifdef DEBUG_simulation
  eo[tr]++;
#endif
#endif
#endif
#ifdef DEBUG_malloc
  event_pop++;
#endif
  if(event_free[tr] == NULL)
   {
    ptr = (Event_p)emalloc(sizeof(struct ENABLING));
#ifdef SWN
    if(tabt[tr].comp_num)
     {
      ptr->npla = (int *)ecalloc(tabt[tr].comp_num,sizeof(int));
#ifdef SYMBOLIC
      ptr->split = (int *)ecalloc(tabt[tr].comp_num,sizeof(int));
#endif
     }
    else 
     {
      ptr->npla = NULL;
#ifdef SYMBOLIC
      ptr->split = NULL;
#endif
     }
#endif
    ptr->trans = tr;
#ifdef DEBUG_malloc
    event_mall++;
#endif
#ifdef SIMULATION
#ifndef SYMBOLIC
#ifdef DEBUG_simulation
    em[tr]++;
    ptr->tag = em[tr];
#endif
#endif
#endif
   }
  else
   {
    ptr = event_free[tr];
    event_free[tr] = event_free[tr]->next;
   }
  ptr->next=NULL;
#ifdef SIMULATION
  ptr->t_next=ptr->t_prev=NULL;
  ptr->e_prev=ptr->e_next=NULL;
  ptr->last_sched_desched_time=ptr->residual_sched_time=-1;
  ptr->creation_time=cur_time;
#endif
  if(IS_IMMEDIATE(tr))
   ptr->enabling_degree = 1;
  else
   {/* Transizione temporizzata */
    if(IS_INFINITE_SERVER(tr))
     ptr->enabling_degree = MAX_INT;
    else
     ptr->enabling_degree = tabt[tr].no_serv;
   }/* Transizione temporizzata */
#ifdef SWN
#ifdef SYMBOLIC
  ptr->ordinary_instances = UNKNOWN;
#endif
  for(i=tabt[tr].comp_num;i;i--)
   {
    ptr->npla[i-1]=UNKNOWN;
#ifdef SYMBOLIC
    ptr->split[i-1]=UNKNOWN;
#endif
   }
#endif
  return(ptr);
 }/* End get_new_event */