void t_script_conditional_action::execute(t_script_context_global const& context ) const
{
	if (get_condition().evaluate(context))
		get_true_subaction().execute(context);
	else
		get_false_subaction().execute(context);
}
Пример #2
0
	std::vector<ConditionInfo> Item::Conditions () const {
	
		std::vector<ConditionInfo> retr;
		
		auto begin=this->begin();
		auto end=this->end();
		
		for (;;) {
		
			auto cond=get_condition(begin,end);
			
			if (cond) retr.push_back(std::move(*cond));
			else return retr;
		
		}
	
	}
void function() {
  if (true) {
  }
  if (false || true) {
  }
  if (false && true) {
  }
  if (CONDITION) {
  }
  if (CONDITION and CONDITION or CONDITION) {
  }
  if (int i = 1) {
  }
  if (int i = get_condition()) {
  }
  if (5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5) {
  }
  if (true)
    if (true)
      if (false) {
      }
}
void function() {
  while (true) {
  }
  while (false || true) {
  }
  while (false && true) {
  }
  while (CONDITION) {
  }
  while (CONDITION and CONDITION or CONDITION) {
  }
  while (int i = 1) {
  }
  while (int i = get_condition()) {
  }
  while (5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5 + 5) {
  }
  while (true)
    while (true)
      while (false) {
      }
}
t_arexp_condition			*arexp_condition_new_from_tokens(t_lst *tokens)
{
	t_arexp					*singleton;
	t_arexp_condition		*condition;

	singleton = arexp_singleton(NULL, false);
	if (singleton->depth > AREXP_MAX_DEPTH)
	{
		singleton->error_msg = twl_strdup("maximum depth reached");
		return (0);
	}
	if (!(condition = get_condition(tokens, singleton)))
		return (NULL);
	condition = set_expression(condition, tokens, singleton);
	if (!condition || !condition->expression_if)
		return (condition);
	if (!(condition->condition_else = get_condition_new(tokens, singleton)))
	{
		arexp_condition_del(condition);
		return (NULL);
	}
	return (condition);
}
Пример #6
0
static rtx
may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn)
{
  rtx test, at, op[2], stest;
  struct rtx_iv iv;
  unsigned i;
  enum machine_mode mode;

  /* BB must end in a simple conditional jump.  */
  if (EDGE_COUNT (bb->succs) != 2)
    return NULL_RTX;
  if (!any_condjump_p (BB_END (bb)))
    return NULL_RTX;

  /* With branches inside loop.  */
  if (!flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 0)->dest)
      || !flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 1)->dest))
    return NULL_RTX;

  /* It must be executed just once each iteration (because otherwise we
     are unable to update dominator/irreducible loop information correctly).  */
  if (!just_once_each_iteration_p (loop, bb))
    return NULL_RTX;

  /* Condition must be invariant.  */
  test = get_condition (BB_END (bb), &at, true, false);
  if (!test)
    return NULL_RTX;

  for (i = 0; i < 2; i++)
    {
      op[i] = XEXP (test, i);

      if (CONSTANT_P (op[i]))
	continue;

      if (!iv_analyze (at, op[i], &iv))
	return NULL_RTX;
      if (iv.step != const0_rtx
	  || iv.first_special)
	return NULL_RTX;

      op[i] = get_iv_value (&iv, const0_rtx);
    }

  mode = GET_MODE (op[0]);
  if (mode == VOIDmode)
    mode = GET_MODE (op[1]);
  if (GET_MODE_CLASS (mode) == MODE_CC)
    {
      if (at != BB_END (bb))
	return NULL_RTX;

      if (!rtx_equal_p (op[0], XEXP (test, 0))
	  || !rtx_equal_p (op[1], XEXP (test, 1)))
	return NULL_RTX;

      *cinsn = BB_END (bb);
      return test;
    }

  stest = simplify_gen_relational (GET_CODE (test), SImode,
				   mode, op[0], op[1]);
  if (stest == const0_rtx
      || stest == const_true_rtx)
    return stest;

  return canon_condition (gen_rtx_fmt_ee (GET_CODE (test), SImode,
					  op[0], op[1]));
}
Пример #7
0
const char *
odbc_get_cmd_line(char **p_s, int *cond)
{
	while (fgets(line_buf, sizeof(line_buf), parse_file)) {
		char *p = line_buf;
		const char *cmd;

		++odbc_line_num;

		cmd = odbc_get_tok(&p);

		/* skip comments */
		if (!cmd || cmd[0] == '#' || cmd[0] == 0 || cmd[0] == '\n')
			continue;

		/* conditional statement */
		if (!strcmp(cmd, "else")) {
			int c = pop_condition();
			push_condition(c);
			*cond = c && !*cond;
			continue;
		}
		if (!strcmp(cmd, "endif")) {
			*cond = pop_condition();
			continue;
		}
		if (!strcmp(cmd, "if")) {
			push_condition(*cond);
			if (*cond)
				*cond = get_condition(&p);
			continue;
		}

		if (strcmp(cmd, "tds_version_cmp") == 0) {
			const char *bool_name = odbc_get_tok(&p);
			const char *cmp = odbc_get_tok(&p);
			const char *s_ver = odbc_get_tok(&p);
			int ver = odbc_tds_version();
			int expected;
			int res;
			unsigned M, m;

			if (!cmp || !s_ver)
				odbc_fatal(": missing parameters\n");
			if (sscanf(s_ver, "%u.%u", &M, &m) != 2)
				odbc_fatal(": invalid version %s\n", s_ver);
			expected = M * 0x100u + m;

			if (strcmp(cmp, ">") == 0)
				res = ver > expected;
			else if (strcmp(cmp, ">=") == 0)
				res = ver >= expected;
			else if (strcmp(cmp, "<") == 0)
				res = ver < expected;
			else if (strcmp(cmp, "<=") == 0)
				res = ver <= expected;
			else if (strcmp(cmp, "==") == 0)
				res = ver == expected;
			else if (strcmp(cmp, "!=") == 0)
				res = ver != expected;
			else
				odbc_fatal(": invalid operator %s\n", cmp);

			if (*cond)
				odbc_set_bool(bool_name, res);
			continue;
		}

		*p_s = p;
		return cmd;
	}
	return NULL;
}
Пример #8
0
/** Return control flow successors. See base class for full documentation. */
Disassembler::AddressSet
SgAsmArmInstruction::get_successors(bool *complete) {
    Disassembler::AddressSet retval;
    const std::vector<SgAsmExpression*> &exprs = get_operandList()->get_operands();
    *complete = true; /*assume retval is the complete set of successors for now*/

    switch (get_kind()) {
        case arm_b:
        case arm_bl:
        case arm_blx:
        case arm_bx: {
            /* Branch target */
            ROSE_ASSERT(exprs.size()==1);
            SgAsmExpression *dest = exprs[0];
            if (isSgAsmValueExpression(dest)) {
                rose_addr_t target_va = SageInterface::getAsmConstant(isSgAsmValueExpression(dest));
                retval.insert(target_va);
            } else {
                /* Could also be a register reference expression, but we don't know the successor in that case. */
                *complete = false;
            }
            
            /* Fall-through address */
            if (get_condition()!=arm_cond_al)
                retval.insert(get_address()+4);
            break;
        }

        case arm_bxj: {
            /* First argument is the register that holds the next instruction pointer value to use in the case that Jazelle is
             * not available. We only know the successor if the register is the instruction pointer, in which case the
             * successor is the fall-through address. */
            ROSE_ASSERT(exprs.size()==1);
            SgAsmArmRegisterReferenceExpression *rre = isSgAsmArmRegisterReferenceExpression(exprs[0]);
            ROSE_ASSERT(rre);
            if (rre->get_descriptor().get_major()==arm_regclass_gpr && rre->get_descriptor().get_minor()==15) {
                retval.insert(get_address()+4);
            } else {
                *complete = false;
            }
            break;
        }
            
        case arm_cmn:
        case arm_cmp:
        case arm_teq:
        case arm_tst:
            /* Comparison and test instructions don't ever affect the instruction pointer; they only fall through */
            retval.insert(get_address()+4);
            break;

        case arm_bkpt:
        case arm_swi:
        case arm_undefined:
        case arm_unknown_instruction:
            /* No known successors for interrupt-generating instructions */
            break;

        default:
            if (!modifies_ip(this) || get_condition()!=arm_cond_al) {
                retval.insert(get_address()+4);
            } else {
                *complete = false;
            }
            break;
    }
    return retval;
}
Пример #9
0
char *
read_line (void)
{
  char *line;

  if (!last_line_reusable) {
    int length;
    char *beginning;
    char *end;

  read_next_line:
    line = NULL;
    while (!line && !string_list_is_empty (&list_files)) {
      line = utils_fgets (list_files.first->file, &length);
      if (!line)
	string_list_delete_first_item (&list_files);
    }

    if (!line)
      return NULL;

    list_files.first->line_number++;

    for (beginning = line; *beginning; beginning++) {
      if (!isspace (*beginning))
	break;
    }

    for (end = line + length; end > beginning; end--) {
      if (!isspace (*(end - 1)))
	break;
    }

    *end = 0;
    if (*beginning) {
      char *scan;

      for (scan = beginning; scan < end; scan++) {
	if (*scan == '$') {
	  if (* ++scan == '$') {
	    char *copy_scan;

	    for (copy_scan = scan; copy_scan < end; copy_scan++)
	      *copy_scan = *(copy_scan + 1);

	    end--;
	  }
	  else {
	    char *second_delimiter_scan;

	    for (second_delimiter_scan = scan + 1;
		 second_delimiter_scan < end; second_delimiter_scan++) {
	      if (*second_delimiter_scan == '$')
		break;
	    }

	    if (second_delimiter_scan < end) {
	      const char *substitution;
	      int substitution_length;
	      char *new_line;

	      *second_delimiter_scan = 0;

	      substitution = association_list_find_association (&substitutions,
								scan);
	      if (!substitution) {
		print_error ("undefined substitution symbol `%s'", scan);
		goto error;
	      }

	      substitution_length = strlen (substitution);
	      new_line
		= utils_cat_as_strings (NULL,
					beginning, (scan - 1) - beginning,
					substitution, substitution_length,
					second_delimiter_scan + 1,
					end - (second_delimiter_scan + 1),
					NULL);
	      scan	= new_line + (((scan - 1) - beginning)
				      + substitution_length);
	      beginning = new_line;
	      end	= scan + (end - (second_delimiter_scan + 1));

	      utils_free (line);
	      line = new_line;
	    }
	    else {
	      print_error ("warning: possible unterminated substitution");
	      break;
	    }
	  }
	}
      }

      if (looking_at ("@include_list", &beginning)) {
	if (*beginning) {
	  FILE *new_list_file = fopen (beginning, "r");

	  if (new_list_file) {
	    string_list_prepend_from_buffer (&list_files,
					     beginning, end - beginning);
	    list_files.first->file = new_list_file;
	    list_files.first->line_number = 0;
	  }
	  else {
	    print_error ("can't open file %s for reading", beginning);
	    string_list_empty (&list_files);
	  }
	}
	else {
	  print_error ("name of file to include is missing");
	  string_list_empty (&list_files);
	}

	utils_free (line);
	goto read_next_line;
      }
      else if (looking_at ("@if", &beginning)) {
	const PredefinedCondition *condition = get_condition (&beginning);

	if (!condition)
	  goto error;

	push_condition_stack (condition, 0);

	utils_free (line);
	goto read_next_line;
      }
      else if (looking_at ("@ifnot", &beginning)) {
	const PredefinedCondition *condition = get_condition (&beginning);

	if (!condition)
	  goto error;

	push_condition_stack (condition, 1);

	utils_free (line);
	goto read_next_line;
      }
      else if (looking_at ("@else", &beginning)) {
	if (!condition_stack || condition_stack->is_in_else_clause) {
	  print_error ("unexpected `@else'");
	  goto error;
	}

	condition_stack->is_in_else_clause = 1;

	utils_free (line);
	goto read_next_line;
      }
      else if (looking_at ("@endif", &beginning)) {
	if (!condition_stack) {
	  print_error ("unexpected `@endif'");
	  goto error;
	}

	pop_condition_stack ();

	utils_free (line);
	goto read_next_line;
      }
    }

    if (condition_stack
	&& !(condition_stack->is_true ^ condition_stack->is_in_else_clause)) {
      /* In conditioned block and with false condition: skip line. */
      utils_free (line);
      goto read_next_line;
    }

    string_list_add_from_buffer (&lines, beginning, end - beginning);
    utils_free (line);
  }

  last_line_reusable = 0;
  return lines.last->text;

 error:
  string_list_empty (&list_files);
  utils_free (line);

  return NULL;
}
Пример #10
0
static int
do_parse_lists (FILE *h_file, FILE *c_file, const ListDescription *lists)
{
  int k;
  int result = 1;
  int had_c_includes = 0;
  int had_h_includes = 0;
  int in_list = 0;
  int equal_to_last = 0;
  int h_file_line_length = 0;
  int num_c_file_array_elements = 0;
  int pending_linefeeds = 0;
  const char *h_file_enum_name = NULL;
  const char *c_file_array_name = NULL;
  char *last_identifier = NULL;
  char *pending_h_comment = NULL;
  char *pending_c_comment = NULL;
  char *pending_eol_comment = NULL;
  StringBuffer c_file_arrays[NUM_LIST_SORT_ORDERS];
  StringBuffer *list_c_file_array = NULL;
  StringBuffer h_file_enums;

  string_buffer_init (&h_file_top, 0x2000, 0x1000);
  string_buffer_init (&h_file_bottom, 0x2000, 0x1000);
  string_buffer_init (&h_file_enums, 0x2000, 0x1000);

  string_buffer_init (&c_file_top, 0x2000, 0x1000);
  string_buffer_init (&c_file_bottom, 0x2000, 0x1000);
  for (k = 0; k < NUM_LIST_SORT_ORDERS; k++)
    string_buffer_init (&c_file_arrays[k], 0x2000, 0x1000);

  while (1) {
    char *line = read_line ();

    if (!line) {
      while (lists->name && lists->multiple_lists_allowed)
	lists++;

      if (!condition_stack) {
	if (!lists->name) {
	  result = 0;

	  if (lists->list_finalizer) {
	    if (lists->list_finalizer (NULL))
	      result = 1;
	  }
	}
	else {
	  fprintf (stderr,
		   "%s: unexpected end of file: list of type `%s' expected\n",
		   short_program_name, lists->name);
	}
      }
      else {
	fprintf (stderr,
		 "%s: unexpected end of file: condition `%s' unterminated\n",
		 short_program_name, condition_stack->condition->identifier);
      }

      break;
    }

    if (! *line)
      continue;

    if (line[0] == '#') {
      if (line[1] == '>') {
	line = line + 2;
	while (isspace (*line))
	  line++;

	utils_free (pending_h_comment);
	pending_h_comment = utils_duplicate_string (line);

	utils_free (pending_c_comment);
	pending_c_comment = utils_duplicate_string (line);
      }

      continue;
    }

    if (in_list) {
      if (line[0] != '}') {
	char first_char = line[0];
	const char *identifier = NULL;

	if (first_char != '=' && first_char != '+') {
	  if (lists->line_parser1) {
	    if (lists->line_parser1 (&line))
	      break;

	    if (!line)
	      continue;

	    while (*line && isspace (*line))
	      line++;
	  }
	}
	else {
	  if (!h_file_enum_name) {
	    print_error ("`+' and `=' directives are not allowed "
			 "in lists that don't generate enumerations");
	    break;
	  }

	  do
	    line++;
	  while (isspace (*line));
	}

	if ((!pending_eol_comment || ! *pending_eol_comment)
	    && last_identifier
	    && h_file_enum_name)
	  string_buffer_cat_string (&h_file_enums, ",\n");

	if (pending_eol_comment) {
	  if (*pending_eol_comment && h_file_enum_name) {
	    string_buffer_cprintf (&h_file_enums, ",%s/* %s */\n",
				   TABBING (7, h_file_line_length + 1),
				   pending_eol_comment);
	  }

	  utils_free (pending_eol_comment);
	  pending_eol_comment = NULL;
	}

	if (pending_h_comment) {
	  if (*pending_h_comment && h_file_enum_name) {
	    if (last_identifier)
	      string_buffer_add_character (&h_file_enums, '\n');
	    string_buffer_cat_strings (&h_file_enums,
				       "  /* ", pending_h_comment, " */\n",
				       NULL);
	  }

	  utils_free (pending_h_comment);
	  pending_h_comment = NULL;
	}

	if (h_file_enum_name) {
	  identifier = parse_thing (IDENTIFIER, &line, "identifier");
	  if (!identifier)
	    break;

	  string_buffer_cat_strings (&h_file_enums, "  ", identifier, NULL);
	  h_file_line_length = 2 + strlen (identifier);

	  if (first_char == '=' || equal_to_last) {
	    string_buffer_cat_strings (&h_file_enums,
				       " = ", last_identifier, NULL);
	    h_file_line_length += 3 + strlen (last_identifier);
	  }

	  utils_free (last_identifier);
	  last_identifier = utils_duplicate_string (identifier);
	}

	if (first_char != '+') {
	  if (first_char != '=') {
	    if (c_file_array_name && *lists->c_file_array_type) {
	      if (num_c_file_array_elements > 0) {
		string_buffer_add_character (list_c_file_array, ',');
		string_buffer_add_characters (list_c_file_array, '\n',
					      1 + pending_linefeeds);
	      }

	      if (pending_c_comment) {
		if (*pending_c_comment) {
		  if (num_c_file_array_elements > 0)
		    string_buffer_add_character (list_c_file_array, '\n');

		  string_buffer_cat_strings (list_c_file_array,
					     "  /* ", pending_c_comment,
					     " */\n", NULL);
		}

		utils_free (pending_c_comment);
		pending_c_comment = NULL;
	      }
	    }

	    if (c_file_array_name)
	      num_c_file_array_elements++;

	    pending_linefeeds = 0;
	    if (lists->line_parser2 (list_c_file_array, &line, identifier,
				     &pending_eol_comment, &pending_linefeeds))
	      break;

	    if (*line) {
	      print_error ("unexpected characters at the end of line");
	      break;
	    }

	    if (pending_linefeeds < 0) {
	      pending_linefeeds = 0;
	      if (! *line) {
		while (1) {
		  line = read_line ();

		  if (line && ! *line)
		    pending_linefeeds++;
		  else {
		    reuse_last_line (&line);
		    break;
		  }
		}
	      }
	    }
	  }

	  equal_to_last = 0;
	}
	else {
	  if (equal_to_last) {
	    print_error ("second inserted identifier in a row; "
			 "did you mean `='?");
	    break;
	  }

	  equal_to_last = 1;
	}
      }
      else {
	if (!last_identifier && num_c_file_array_elements == 0) {
	  print_error ("empty list `%s'", lists->name);
	  break;
	}

	if (pending_eol_comment) {
	  if (*pending_eol_comment && h_file_enum_name) {
	    string_buffer_cprintf (&h_file_enums, "%s/* %s */",
				   TABBING (7, h_file_line_length),
				   pending_eol_comment);
	  }

	  utils_free (pending_eol_comment);
	  pending_eol_comment = NULL;
	}

	if (lists->list_finalizer) {
	  if (lists->list_finalizer (list_c_file_array))
	    break;
	}

	if (h_file_enum_name) {
	  if (strcmp (h_file_enum_name, "unnamed") != 0) {
	    string_buffer_cat_strings (&h_file_enums,
				       "\n} ", h_file_enum_name, ";\n", NULL);
	  }
	  else
	    string_buffer_cat_string (&h_file_enums, "\n};\n");
	}

	if (c_file_array_name && *lists->c_file_array_type)
	  string_buffer_cat_string (list_c_file_array, "\n};\n");

	if (!lists->multiple_lists_allowed)
	  lists++;

	in_list = 0;
      }
    }
    else {
      if (looking_at ("@include", &line) || looking_at ("@c_include", &line)) {
	if (! *line) {
	  print_error ("filename expected");
	  break;
	}

	if (!had_c_includes) {
	  fputs ("\n\n", c_file);
	  had_c_includes = 1;
	}

	fprintf (c_file, "#include %s\n", line);
      }
      else if (looking_at ("@h_include", &line)) {
	if (! *line) {
	  print_error ("filename expected");
	  break;
	}

	if (had_h_includes != 1) {
	  fputs ((had_h_includes == 0 ? "\n\n" : "\n"), h_file);
	  had_h_includes = 1;
	}

	fprintf (h_file, "#include %s\n", line);
      }
      else if (looking_at ("@define_condition", &line)) {
	const PredefinedCondition *condition = get_condition (&line);

	if (!condition)
	  break;

	if (had_h_includes != 2) {
	  fputs ((had_h_includes == 0 ? "\n\n" : "\n"), h_file);
	  had_h_includes = 2;
	}

	fprintf (h_file, "#define %s%s%d\n",
		 condition->identifier,
		 TABBING (4, 8 + strlen (condition->identifier)),
		 condition->value);
      }
      else {
	const char *identifier = parse_thing (IDENTIFIER, &line, "list name");

	if (!identifier)
	  break;

	if (!lists->name) {
	  print_error ("unexpected list beginning");
	  break;
	}

	if (lists->multiple_lists_allowed
	    && strcmp (identifier, lists->name) != 0
	    && (lists + 1)->name)
	  lists++;

	if (strcmp (identifier, lists->name) == 0) {
	  if (looking_at ("-", &line)) {
	    if (lists->enumeration_required) {
	      print_error ("enumeration name expected");
	      break;
	    }

	    h_file_enum_name = NULL;
	  }
	  else {
	    h_file_enum_name = parse_thing (IDENTIFIER, &line,
					    "enumeration name");
	    if (!h_file_enum_name)
	      break;
	  }

	  if (!lists->c_file_array_type) {
	    if (!looking_at ("-", &line)) {
	      print_error ("unexpected array name");
	      break;
	    }

	    c_file_array_name = NULL;
	  }
	  else {
	    if (looking_at ("-", &line)) {
	      print_error ("array name expected");
	      break;
	    }

	    c_file_array_name = parse_thing (IDENTIFIER, &line,
					     "array name");
	    if (!c_file_array_name)
	      break;
	  }

	  if (*line != '{') {
	    print_error ("list opening brace expected");
	    break;
	  }

	  if (*(line + 1)) {
	    print_error ("unexpected characters at the end of line");
	    break;
	  }

	  if (pending_h_comment) {
	    if (*pending_h_comment && h_file_enum_name) {
	      string_buffer_cat_strings (&h_file_enums,
					 "/* ", pending_h_comment, " */\n",
					 NULL);
	    }

	    utils_free (pending_h_comment);
	    pending_h_comment = NULL;
	  }

	  assert (0 <= lists->sort_order
		  && lists->sort_order <= NUM_LIST_SORT_ORDERS);
	  list_c_file_array = &c_file_arrays[lists->sort_order];

	  if (h_file_enum_name) {
	    if (strcmp (h_file_enum_name, "unnamed") != 0)
	      string_buffer_cat_string (&h_file_enums, "\n\ntypedef enum {\n");
	    else
	      string_buffer_cat_string (&h_file_enums, "\n\nenum {\n");
	  }

	  if (c_file_array_name && *lists->c_file_array_type) {
	    string_buffer_cat_strings (list_c_file_array,
				       "\n\n", lists->c_file_array_type,
				       c_file_array_name, "[] = {\n", NULL);
	  }

	  if (lists->list_initializer) {
	    if (lists->list_initializer (list_c_file_array,
					 h_file_enum_name, c_file_array_name))
	      break;
	  }

	  in_list		    = 1;
	  equal_to_last		    = 0;
	  num_c_file_array_elements = 0;
	  pending_linefeeds	    = 1;

	  utils_free (last_identifier);
	  last_identifier = NULL;
	}
	else {
	  print_error ("list name `%s' expected, got `%s'",
		       lists->name, identifier);
	  break;
	}
      }
    }
  }

  if (h_file_top.length > 0)
    fwrite (h_file_top.string, h_file_top.length, 1, h_file);

  if (h_file_enums.length > 0)
    fwrite (h_file_enums.string, h_file_enums.length, 1, h_file);

  if (h_file_bottom.length > 0)
    fwrite (h_file_bottom.string, h_file_bottom.length, 1, h_file);

  string_buffer_dispose (&h_file_top);
  string_buffer_dispose (&h_file_bottom);
  string_buffer_dispose (&h_file_enums);

  if (c_file_top.length > 0)
    fwrite (c_file_top.string, c_file_top.length, 1, c_file);

  for (k = 0; k < NUM_LIST_SORT_ORDERS; k++) {
    fwrite (c_file_arrays[k].string, c_file_arrays[k].length, 1, c_file);
    string_buffer_dispose (&c_file_arrays[k]);
  }

  if (c_file_bottom.length > 0)
    fwrite (c_file_bottom.string, c_file_bottom.length, 1, c_file);

  string_buffer_dispose (&c_file_top);
  string_buffer_dispose (&c_file_bottom);

  utils_free (last_identifier);
  utils_free (pending_h_comment);
  utils_free (pending_c_comment);
  utils_free (pending_eol_comment);

  string_list_empty (&lines);

  return result;
}