m1dnight

Untitled

Jul 26th, 2014
546
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.18 KB | None | 0 0
  1. static EXP_type evaluate_sequence(PAI_type Expressions)
  2.   { sEQ_type sequence_thread;
  3.     CNT_type continuation;
  4.     EXP_type expression;
  5.     PAI_type expressions;
  6.     TAG_type tag;
  7.     expression  = Expressions->car;
  8.     expressions = Expressions->cdr;
  9.     tag = Tag_of(expressions);
  10.     switch (tag)
  11.       { case NUL_tag:
  12.           return evaluate_expression(expression);
  13.         case PAI_tag:
  14.           // If the previous continuation was a continue_sequence we can reuse it.
  15.           continuation = Thread_Peek();
  16.           printf("%d\n",continuation->cfn);
  17.           printf("%d\n", Continue_sequence);
  18.           if(continuation->cfn == Continue_sequence)
  19.           {
  20.               printf("Reusing frame\n");
  21.               sequence_thread = (sEQ_type)continuation;
  22.               sequence_thread->exs = expressions;
  23.           }
  24.           else
  25.           {
  26.               continuation = Thread_Push(Continue_sequence,
  27.                                          sEQ_size);
  28.               sequence_thread = (sEQ_type)continuation;
  29.               sequence_thread->exs = expressions;
  30.           }
  31.           return evaluate_expression(expression);
  32.       }
  33.     return Main_Error_Text(ITF_error_string,
  34.                            Main_Sequence_String); }
Advertisement
Add Comment
Please, Sign In to add comment