Exemple #1
0
int main(int argc, char *argv[]) {
  FILE *parFile = fopen(GCODE_PARAMETER_STORE, "r");
  FILE *inputFile = (argc > 1 ? fopen(argv[1], "r") : stdin);
  char line[0xFF];

  init_parameters(parFile);
  init_machine(NULL);
  init_stacks(NULL);
  init_tools(NULL);
  init_input(inputFile);
  //TODO: align API, add done_gcode_state().
  init_gcode_state(NULL);
  init_cycles(NULL);
  //TODO: align API, make it take a pointer to init data.
  init_queue();
  init_checker(NULL);

  while(machine_running() && gcode_running() && fetch_line_input(line)) {
    if(gcode_check(line)) update_gcode_state(line);
    move_machine_queue();
  }
  /* Flush movement queue */
  while(move_machine_queue());

  done_checker();
  done_queue();
  done_cycles();
  done_input();
  done_tools();
  done_stacks();
  done_machine();
  done_parameters();

  return 0;
}
Exemple #2
0
int main(int argc, char *argv[])
{
    init_dict();
    convert_command_line(argc, argv);
    init_stacks();
    mu_find_init_file();
    mu_load_file();
    mu_start_up();
    return 0;
}
Exemple #3
0
void factor_vm::init_factor(vm_parameters *p)
{
	/* Kilobytes */
	p->ds_size = align_page(p->ds_size << 10);
	p->rs_size = align_page(p->rs_size << 10);
	p->callback_size = align_page(p->callback_size << 10);

	/* Megabytes */
	p->young_size <<= 20;
	p->aging_size <<= 20;
	p->tenured_size <<= 20;
	p->code_size <<= 20;

	/* Disable GC during init as a sanity check */
	gc_off = true;

	/* OS-specific initialization */
	early_init();

	const vm_char *executable_path = vm_executable_path();

	if(executable_path)
		p->executable_path = executable_path;

	if(p->image_path == NULL)
		p->image_path = default_image_path();

	srand((unsigned int)system_micros());
	init_ffi();
	init_stacks(p->ds_size,p->rs_size);
	init_callbacks(p->callback_size);
	load_image(p);
	init_c_io();
	init_inline_caching(p->max_pic_size);
	if(p->signals)
		init_signals();

	if(p->console)
		open_console();

	init_profiler();

	special_objects[OBJ_CPU] = allot_alien(false_object,(cell)FACTOR_CPU_STRING);
	special_objects[OBJ_OS] = allot_alien(false_object,(cell)FACTOR_OS_STRING);
	special_objects[OBJ_CELL_SIZE] = tag_fixnum(sizeof(cell));
	special_objects[OBJ_EXECUTABLE] = allot_alien(false_object,(cell)p->executable_path);
	special_objects[OBJ_ARGS] = false_object;
	special_objects[OBJ_EMBEDDED] = false_object;

	/* We can GC now */
	gc_off = false;

	if(!to_boolean(special_objects[OBJ_STAGE2]))
		prepare_boot_image();
}
Exemple #4
0
void factorvm::init_factor(vm_parameters *p)
{
	/* Kilobytes */
	p->ds_size = align_page(p->ds_size << 10);
	p->rs_size = align_page(p->rs_size << 10);

	/* Megabytes */
	p->young_size <<= 20;
	p->aging_size <<= 20;
	p->tenured_size <<= 20;
	p->code_size <<= 20;

	/* Disable GC during init as a sanity check */
	gc_off = true;

	/* OS-specific initialization */
	early_init();

	const vm_char *executable_path = vm_executable_path();

	if(executable_path)
		p->executable_path = executable_path;

	if(p->image_path == NULL)
		p->image_path = default_image_path();

	srand(current_micros());
	init_ffi();
	init_stacks(p->ds_size,p->rs_size);
	load_image(p);
	init_c_io();
	init_inline_caching(p->max_pic_size);
	init_signals();

	if(p->console)
		open_console();

	init_profiler();

	userenv[CPU_ENV] = allot_alien(F,(cell)FACTOR_CPU_STRING);
	userenv[OS_ENV] = allot_alien(F,(cell)FACTOR_OS_STRING);
	userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(cell));
	userenv[EXECUTABLE_ENV] = allot_alien(F,(cell)p->executable_path);
	userenv[ARGS_ENV] = F;
	userenv[EMBEDDED_ENV] = F;

	/* We can GC now */
	gc_off = false;

	if(userenv[STAGE2_ENV] == F)
	{
		userenv[STACK_TRACES_ENV] = tag_boolean(p->stack_traces);
		do_stage1_init();
	}
}
Exemple #5
0
/* Get things started */
void init_factor(F_PARAMETERS *p)
{
	/* Kilobytes */
	p->ds_size = align_page(p->ds_size << 10);
	p->rs_size = align_page(p->rs_size << 10);

	/* Megabytes */
	p->young_size <<= 20;
	p->aging_size <<= 20;
	p->tenured_size <<= 20;
	p->code_size <<= 20;

	/* Disable GC during init as a sanity check */
	gc_off = true;

	/* OS-specific initialization */
	early_init();

	if(p->image == NULL)
		p->image = default_image_path();

	srand(current_micros());
	init_ffi();
	init_stacks(p->ds_size,p->rs_size);
	load_image(p);
	init_c_io();
	init_signals();

	if(p->console)
		open_console();

	stack_chain = NULL;
	profiling_p = false;
	performing_gc = false;
	last_code_heap_scan = NURSERY;
	collecting_aging_again = false;

	userenv[CPU_ENV] = tag_object(from_char_string(FACTOR_CPU_STRING));
	userenv[OS_ENV] = tag_object(from_char_string(FACTOR_OS_STRING));
	userenv[CELL_SIZE_ENV] = tag_fixnum(sizeof(CELL));
	userenv[STACK_TRACES_ENV] = tag_boolean(p->stack_traces);

	/* We can GC now */
	gc_off = false;

	if(!stage2)
		do_stage1_init();
}
Exemple #6
0
static void *init_thread (void *info_p)
{
  int my_index;
  int *my_index_p;
  start_info_t info;
  my_index_p = (int *)malloc(sizeof(int));
  info = *((start_info_t *)info_p);
  free(info_p);
  /* Retrieve the next index in the thread arrays and lock it so
     another starting thread cannot get the same index */

  *my_index_p = info.my_index;
  my_index = *my_index_p;
  pthread_setspecific(index_key, (void *)my_index_p);
  /* Increment also releases the gc lock on next_index so another
     starting thread can get the lock, or a thread that is gc'ing can
     get the lock */

  /* Shouldn't get interrupted for gc until after stacks are
     created.  This is below here in the vm not checking intterupts
     until after we get to the loop */

  value_stack_array[my_index] = (oakstack*)malloc (sizeof (oakstack));
  cntxt_stack_array[my_index] = (oakstack*)malloc(sizeof (oakstack));

  value_stack_array[my_index]->size = value_stack_array[0]->size;
  value_stack_array[my_index]->filltarget = value_stack_array[0]->filltarget;
  cntxt_stack_array[my_index]->size = cntxt_stack_array[0]->size;
  cntxt_stack_array[my_index]->filltarget = cntxt_stack_array[0]->filltarget;

  init_stacks ();
  register_array[my_index] = (register_set_t*)malloc(sizeof (register_set_t));

  memcpy(register_array[my_index], register_array[info.parent_index],
	 sizeof(register_set_t));

  gc_examine_ptr = gc_examine_buffer;

  /* At this point, it should be OK if the garbage collector gets run. */
  e_pc = &tail_recurse_instruction;
  e_nargs = 0;

  /* Big virtual machine interpreter loop */
  loop(info.start_operation);

  return 0;
}
Exemple #7
0
int main(int, char**)
{

   diskStack stacks[STACK_COUNT];
   
   init_stacks(stacks);
   
   std::cout << "Init: \n";
   print_stacks(stacks);
   
   std::cout << std::endl;
   move_disks(stacks,DISK_MAX , 0, 1, 2);
   std::cout << std::endl<< "Final: " << std::endl;

   print_stacks(stacks);


   return 0;
}
Exemple #8
0
void _PrepC(void)
{
#ifdef CONFIG_INIT_STACKS
	init_stacks();
#endif
	/*
	 * Set PSP and use it to boot without using MSP, so that it
	 * gets set to _interrupt_stack during initialization.
	 */
	set_and_switch_to_psp();
	relocate_vector_table();
	enable_floating_point();
	_bss_zero();
	_data_copy();
#ifdef CONFIG_BOOT_TIME_MEASUREMENT
	__start_time_stamp = 0U;
#endif
	_IntLibInit();
	_Cstart();
	CODE_UNREACHABLE;
}
Exemple #9
0
tsd_t *ReginaInitializeProcess(void)
{
   int OK;

   if (__regina_tsd_initialized)
      return(&__regina_tsd);
   __regina_tsd_initialized = 1;

                                        /* Set up the current (single) tsd_t:*/
                                        /* Default all values to zero        */
   memset(&__regina_tsd,0,sizeof(__regina_tsd));
   __regina_tsd.MTMalloc = MTMalloc;
   __regina_tsd.MTFree = MTFree;
   __regina_tsd.MTExit = MTExit;

   /* Since the local data structure contains a memory chain for the memory
    * management we initialize it first.
    */
   if ((__regina_tsd.mt_tsd = malloc(sizeof(mt_tsd_t))) == NULL)
      return(NULL);                     /* This is a catastrophy             */
   memset(__regina_tsd.mt_tsd,0,sizeof(mt_tsd_t));

   OK = init_memory(&__regina_tsd);     /* Initialize the memory module FIRST*/

   /* Without the initial memory we don't have ANY chance! */
   if (!OK)
      return(NULL);

   /*
    * Some systems with an own MT file don't compile in MT mode. But they
    * still are systems of that kind.
    */
#if defined(WIN32) || defined(__WIN32__)
   {
      extern OS_Dep_funcs __regina_OS_Win;
      __regina_tsd.OS = &__regina_OS_Win;
   }
#elif defined(OS2) && !defined(DOS)
   {
      extern OS_Dep_funcs __regina_OS_Os2;
      __regina_tsd.OS = &__regina_OS_Os2;
   }
#elif defined(GO32)
   {
      extern OS_Dep_funcs __regina_OS_Other;
      __regina_tsd.OS = &__regina_OS_Other;
   }
#elif defined(unix) || defined(__unix__) || defined(__unix) || defined(__QNX__) || defined(__BEOS__) || defined(SKYOS) || ( defined( __APPLE_CC__ ) && defined( __MACH__ ) )
   {
      extern OS_Dep_funcs __regina_OS_Unx;
      __regina_tsd.OS = &__regina_OS_Unx;
   }
#else
   {
      extern OS_Dep_funcs __regina_OS_Other;
      __regina_tsd.OS = &__regina_OS_Other;
   }
#endif
   __regina_tsd.OS->init();
   OK |= init_vars(&__regina_tsd);      /* Initialize the variable module    */
   OK |= init_stacks(&__regina_tsd);    /* Initialize the stack module       */
   OK |= init_filetable(&__regina_tsd); /* Initialize the files module       */
   OK |= init_math(&__regina_tsd);      /* Initialize the math module        */
   OK |= init_spec_vars(&__regina_tsd); /* Initialize the interprt module    */
   OK |= init_tracing(&__regina_tsd);   /* Initialize the tracing module     */
   OK |= init_builtin(&__regina_tsd);   /* Initialize the builtin module     */
   OK |= init_client(&__regina_tsd);    /* Initialize the client module      */
   OK |= init_library(&__regina_tsd);   /* Initialize the library module     */
   OK |= init_rexxsaa(&__regina_tsd);   /* Initialize the rexxsaa module     */
   OK |= init_shell(&__regina_tsd);     /* Initialize the shell module       */
   OK |= init_envir(&__regina_tsd);     /* Initialize the envir module       */
   OK |= init_expr(&__regina_tsd);      /* Initialize the expr module        */
   OK |= init_error(&__regina_tsd);     /* Initialize the error module       */
#ifdef VMS
   OK |= init_vms(&__regina_tsd);       /* Initialize the vmscmd module      */
   OK |= init_vmf(&__regina_tsd);       /* Initialize the vmsfuncs module    */
#endif
   OK |= init_arexxf(&__regina_tsd);    /* Initialize the arxfuncs modules */
   __regina_tsd.loopcnt = 1;            /* stupid r2perl-module              */
   __regina_tsd.traceparse = -1;
   __regina_tsd.thread_id = 1;

   if (!OK)
      exiterror( ERR_STORAGE_EXHAUSTED, 0 ) ;

   return(&__regina_tsd);
}
Exemple #10
0
int
main(int argc, char **argv)
{
#ifdef THREADS
    int my_index;
    int *my_index_p;
    pthread_key_create (&index_key, (void*)free_registers);
#endif

#ifdef THREADS
    my_index_p = (int *)malloc (sizeof (int));
    *my_index_p = get_next_index();
    pthread_setspecific (index_key, (void*)my_index_p);
    my_index_p = pthread_getspecific(index_key);
    my_index = *my_index_p;
    gc_ready[my_index] = 0;
    /* inc_next_index();*/
    value_stack_array[my_index] = (oakstack*)malloc (sizeof (oakstack));
    cntxt_stack_array[my_index] = (oakstack*)malloc(sizeof (oakstack));
    value_stack.size = 1024;
    value_stack.filltarget = 1024/2;
    context_stack.size = 512;
    context_stack.filltarget = 512/2;
    gc_examine_ptr = gc_examine_buffer;
#endif

    parse_cmd_line(argc, argv);

    init_weakpointer_tables();

    init_stacks();

    read_world(world_file_name);

    new_space.size = e_next_newspace_size = original_newspace_size;
    alloc_space(&new_space, new_space.size);
    free_point = new_space.start;

#ifdef THREADS
    register_array[my_index] = (register_set_t*)malloc(sizeof(register_set_t));
#else
    reg_set = (register_set_t*)malloc(sizeof(register_set_t));
#endif

    /* Set the registers to the boot code */

    e_current_method = e_boot_code;
    e_env = REF_TO_PTR(REF_SLOT(e_current_method, METHOD_ENV_OFF));
    e_code_segment = REF_SLOT(e_current_method, METHOD_CODE_OFF);
    e_pc = CODE_SEG_FIRST_INSTR(e_code_segment);

    /* Put a reasonable thing in e_bp to avoid confusing GC */
    e_bp = e_env;

    /* Tell the boot function the truth */
    e_nargs = 0;

    /* Big virtual machine interpreter loop */
    loop(INT_TO_REF(54321));

    return 0;
}
Exemple #11
0
command_stream_t
make_command_stream (int (*get_next_byte) (void *),
         void *get_next_byte_argument)
{ 
  char *operators[] = { "&&", "||", "|", "(", ")", ";" };//, "\n" };
  int precedences[] = {   1,    1,   2,  4,   -1,   0, 0 };

  int i, j, isOperator, numChars = 0, inComment = 0;
  int operatorNumber = 0;
  int possibleNewCommand = 0;
  unsigned int currentWordSize = 16 * sizeof(char);

  int lastOperatorWasRightP = 0;
  char *operand, *lastCommand, *currentWord = checked_malloc(16 * sizeof(char));
  char c = (char) get_next_byte(get_next_byte_argument);

  command_t operand1, operand2;

  // Initialize command stream
  command_stream_t commandStream = checked_malloc(10 * sizeof(struct command));
  commandStream->currentStreamSize = 10 * sizeof(struct command);
  commandStream->numCommands = 0;
  commandStream->currentCommand = 0;

  g_lineNumber = 0;

  init_stacks();
  while(c != EOF) 
  {
    //printf("loop entered\n");
    if( c == '\n') 
    {
      g_lineNumber++;
    }

    if(inComment)
    {
      if( c == '\n' ) 
      {
        inComment = 0;
        c = get_next_byte(get_next_byte_argument);
        continue;
      }
      else
      {
        c = get_next_byte(get_next_byte_argument);
        continue;
      }
    }
    else if( c == '#' )
    {
      inComment = 1;
      c = get_next_byte(get_next_byte_argument);
      continue;
    }

    /**
     * Basically if there is a non-operator followed by a newline, there is a possibility
     * that the current command is done. The current command will be over if the newline
     * is then followed by another non-operator. Also ignore newlines inside commands.
     */

    //printf("possible New COmmand is set to %i\n",possibleNewCommand);
    if ( (!isOperator || lastOperatorWasRightP)  && c == '\n') 
    {
      possibleNewCommand = 1;
      //printf("PossibleNewCommand set to 1 char is %c\n",c);
      // Used if a new command is actually started to finish the current one
      lastCommand = currentWord;
      fpos_t pos;
      fgetpos(get_next_byte_argument, &pos);
      c = get_next_byte(get_next_byte_argument);
      if (c != '\n') 
      {
        //printf("continuing after setting possibleNewCommand to 1\n");
       // if(c == EOF)
        // printf("new character is EOF and num of operands left is %i\n",g_iOperand_stack_size);
        fsetpos(get_next_byte_argument, &pos);
        lastOperatorWasRightP = 0;
        continue;
      }
      else {
        g_lineNumber++;
      }
    } 
    else if (c == '\n') 
    {
      c = get_next_byte(get_next_byte_argument);
      //printf("Operator followed by newlien detected. continiuing\n");
      
      lastOperatorWasRightP = 0;
      continue;
    }
    //printf("Checkpoint 2\n");
    /**
     * This loop checks if the current char is an operator. If it is, we create the operator word
     * and then we check the next char in case of double char operators such as || or &&
     */
    lastOperatorWasRightP = 0;
    isOperator = 0;
    for (i = 0; i < 6; i++) 
    { // check if start of an operator
      if (c == operators[i][0]) 
      {
        isOperator = 1;
        operand = currentWord; // Save old operand before creating operator
        currentWord = checked_malloc(3 * sizeof(char));
        // Create the operator word
        currentWord[0] = c;
        fpos_t pos;
        fgetpos(get_next_byte_argument, &pos);
        
    
        if (c == '|' || c == '&') 
        {
          if(g_iOperand_stack_size <= 0 && numChars <= 0)
            error(1,0,"%i: Did not expect binary operator",g_lineNumber);
          
          char current_char = c;
          c = get_next_byte(get_next_byte_argument);
          currentWord[1] = c;
          currentWord[2] = '\0';
          if (c == '|' && c == current_char) 
          {
            i = OR;
          } 
          else if (c == '&' && c == current_char) 
          {
            i = AND;
          }
          else if( current_char == '&' && c != current_char)
          {
            //TODO: Throw syntax error here. Single &!
            //fprintf(stderr,"%i: Isolated & found. Not a valid word character, and it is not an &&",lineNumber);
            error(1,0,"%i: Isolated & found",g_lineNumber);
          }
          else 
          {
            i = PIPE;
            currentWord[1] = '\0';
            fsetpos(get_next_byte_argument, &pos);
          }
        }
        else if( c == '(')
        {
          //printf("Found leftP\n");
          i = LEFTP;
          currentWord[1] = '\0';
          fsetpos(get_next_byte_argument, &pos);
        } 
        else if( c == ')')
        {
          //printf("Found rightP\n");
          lastOperatorWasRightP = 1;
          i = RIGHTP;
          currentWord[1] = '\0';
          fsetpos(get_next_byte_argument, &pos);
        }
        else if( c == ';')  
        {  
          if(g_iOperand_stack_size <= 0 && numChars <= 0)
            error(1,0,"%i: Did not expect binary operator",g_lineNumber);
          currentWord[1] = '\0';
          fsetpos(get_next_byte_argument, &pos);
        }
        else
        {
          currentWord[1] = '\0';
          fsetpos(get_next_byte_argument, &pos);
        }
        break;
      }
    }

    /**
     * When we encounter an operator, we can create a simple command out of the previous word
     * if there was a word (operand) there. This should always happen??
     */
    if (isOperator) 
    {
      //printf("isOperator\n");
      if (numChars > 0) 
      {
        operand[numChars] = '\0';
        //printf("Pushed %s on operand stack\n", operand);
        //get rid of whitespaces in operand here.
        int onlyWhite = getRidOfExtraWhitespaces(operand);
        if(onlyWhite == 0)
          push_operand(createSimpleCommand(operand));
        // printf("simple out of operand %s\n", operand);
        numChars = 0;
      }

      /**
       * While the top of the stack contains an operator with equal or higher precedance than the
       * operator we are currently dealing with, keeping popping one operator and two operands,
       * creating a command out of them, and pushing it onto the operand stack.
       */
      //printf("Charly:top of stack is %i\n",operator_stack_top());
     // if(operator_stack_top() == RIGHTP ) //eval stack until a LEFTP is found
      if(i == RIGHTP)
      {
        //printf("EvalStackuntilLeftP found. possibleNewCommand is %i\n",possibleNewCommand);
        evalStackUntilLeftP();
        //printf("current char is %c\n",c);
        c = get_next_byte(get_next_byte_argument);
        //printf("nextchar is %c\n",c);
        continue;
      }
      while(g_iOperator_stack_size > 0 && g_iOperand_stack_size > 1 
          && (precedences[operator_stack_top()] >= precedences[i]) 
          && ((operator_stack_top() != LEFTP) && i != RIGHTP )) 
      {
        operand2 = pop_operand();
        operand1 = pop_operand();
        operatorNumber = pop_operator();
        //printf("popped operands types %d %d\n", operand1->type, operand2->type);
        //printf("popped operator %s\n", operators[operatorNumber]);
        //printf("pushed type %d operand on stack\n", operatorNumber);
        push_operand(createCommand(operand1, operand2, operatorNumber));
      }

      // Get the operator number for the current word
      for (j = 0; j < 6; j++)
      {
        if (strcmp(currentWord, operators[j]) == 0)
        {
          break;
        }
      }
      //printf("pushed operators %s %d on stack\n", currentWord, j);
      push_operator(j);
      currentWord = checked_malloc(3 * sizeof(char));
    } 
    else if (!possibleNewCommand) 
    {
      //if last operator was rightP. do not run this.
      //printf("not a new command. new char is %c, numChars is %i, currentWordSize is %i\n",c,numChars,currentWordSize);
      if(c != ' ' || numChars > 0)
      {
        //printf("growing current word %s currentWordSize is %i and numChars is %i\n",currentWord,currentWordSize,numChars);
        // Grow current word which is an operand if necessary
        if ((numChars * sizeof(char)) >= currentWordSize)
        {
          //printf("doubling size of word %s\n",currentWord);
          currentWordSize *= 2;
          //char * buffer = checked_malloc(currentWordSize);
          //strncpy(buffer,currentWord,numChars);
          //free((void *)currentWord);
          //currentWord = checked_malloc(currentWordSize);
          //strncpy(currentWord,buffer,numChars);
          currentWord = checked_realloc(currentWord, currentWordSize );// for some reason this was messing up
          //printf("it is now %s\n",currentWord);
        }
        currentWord[numChars] = c;
        numChars++;
      }
    } 
    else 
    {
      //printf("Going to new command. operand stack size is %i\n",g_iOperand_stack_size);
      //printf("Operator stack size is %i. numChars is %i\n",g_iOperator_stack_size,numChars);
       
      //if(g_iOperand_stack_size <= 0)
      //{
       // c =  get_next_byte(get_next_byte_argument);
       // possibleNewCommand = 0;
        //continue;
      //} 
      /**
       * This means that we are about to go onto a new command. We stop the current command and 
       * finish building it with the lastCommand variable, and an operand/operator if necessary.
       * This command is then put into the command stream.
       */
      lastCommand[numChars] = '\0';
      //printf("Last Command getting rid of whites\n"); 
      if(numChars > 0)
      {
        //printf("numchars is > 0 so word is %s\n",lastCommand);
        getRidOfExtraWhitespaces(lastCommand);
        push_operand(createSimpleCommand(lastCommand));
      }
      else if(g_iOperand_stack_size <= 0)
      {
        c =  get_next_byte(get_next_byte_argument);
        possibleNewCommand = 0;
        continue;
      } 

      //else
      //{
       // printf("numChars == 0 so we are continuing\n");
        //continue
       // c = get_next_byte(get_next_byte_argument);
       // possibleNewCommand = 0;
       // continue;
      //}
      evalStack();
      //printf("%s\n", "Finished one command");

      if ((commandStream->numCommands * sizeof(struct command)) == commandStream->currentStreamSize)
      {
        commandStream->currentStreamSize *= 2;
        commandStream = checked_realloc(commandStream, commandStream->currentStreamSize);
      }
      command_t commandToPushToStream = pop_operand();
      commandToPushToStream->status = -1;
      commandStream->stream[commandStream->numCommands] = commandToPushToStream;
      // TODO: if stack not empty, there was an error?
      commandStream->numCommands++;
      numChars = 0;
      currentWord = checked_malloc(3 * sizeof(char)); // prevent overwriting
    }
    //printf("PossibleNewCOmmand set to 0 right before checkpoint1\n");
    c = get_next_byte(get_next_byte_argument);
    possibleNewCommand = 0;
  }

  //printf("Checkpoint1. possibleNEwCommand is %i num of operands is %i\n",possibleNewCommand,g_iOperand_stack_size);
  // Push last word onto operand stack and evaluate the rest
  if (!isOperator) 
  {
    currentWord[numChars] = '\0';
    //printf("pushed simple word %s with word count %i strlen is %i\n", currentWord,numChars,(int)strlen(currentWord));
    getRidOfExtraWhitespaces(currentWord);
    if(strlen(currentWord) > 0)
      push_operand(createSimpleCommand(currentWord));
  } else {
    // if a semicolon, valid?
  }
  //printf("evalstack at the end of loop\n");
  evalStack();
  // Put last command in command stream
  // if there is one!
  if(operand_stack_top() != NULL)
  {
    command_t commandToPushToStream = pop_operand();
    commandToPushToStream->status = -1;
    commandStream->stream[commandStream->numCommands] = commandToPushToStream;
    commandStream->numCommands++;
  }
  //printf("Stack sizes: %d, %d\n", g_iOperator_stack_size, g_iOperand_stack_size);
  //printf("Final command type is %d\n", commandStream->stream[0]->type);

  return commandStream;
}