Example #1
0
File: parser.c Project: SRI-CSL/pce
extern bool input_stack_push_string(char *str) {
  parse_input_t *pinput;

  pinput = (parse_input_t *) safe_malloc(sizeof(parse_input_t));
  pinput->kind = INSTRING;
  pinput->input.in_string.string = str;
  pinput->input.in_string.index = 0;
  input_stack_push(pinput);
  return true;
}
Example #2
0
void do_EVALUATE(char *buff, u32_t length)
{
  if (evaluate_stack_index == INPUT_STACK_DEPTH)
    __ERR_input_stack_overflow();

  input_desc_t *input = &evaluate_stack[evaluate_stack_index++];

  input->id_source_id = -1;
  input->id_refiller = __evaluate_refiller;
  input->id_buffer = buff;
  input->id_length = length;
  input->id_index = 0;
  input->id_max_length = length;
  input->id_blk = 0;

  input_stack_push(input);
}
Example #3
0
File: parser.c Project: SRI-CSL/pce
extern bool input_stack_push_file(char *file) {
  FILE *input;
  parse_input_t *pinput;

  if (strlen(file) == 0) {
    input = stdin;
  } else if ((input = fopen(file, "r")) != NULL) {
    printf("Input from file %s\n", file);
  } else {
    printf("File %s could not be opened\n", file);
    return false;
  }
  pinput = (parse_input_t *) safe_malloc(sizeof(parse_input_t));
  pinput->kind = INFILE;
  pinput->input.in_file.file = file;
  pinput->input.in_file.fps = input;
  input_stack_push(pinput);
  return true;
}