Exemplo n.º 1
0
char *
dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED)
{
  offsetT num;
  char *filename;
  int filename_len;

  /* Continue to accept a bare string and pass it off.  */
  SKIP_WHITESPACE ();
  if (*input_line_pointer == '"')
    {
      s_app_file (0);
      return NULL;
    }

  num = get_absolute_expression ();
  filename = demand_copy_C_string (&filename_len);
  demand_empty_rest_of_line ();

  if (num < 1)
    {
      as_bad (_("file number less than one"));
      return NULL;
    }

  if (num < (int) files_in_use && files[num].filename != 0)
    {
      as_bad (_("file number %ld already allocated"), (long) num);
      return NULL;
    }

  get_filenum (filename, num);

  return filename;
}
Exemplo n.º 2
0
void
dwarf2_where (struct dwarf2_line_info *line)
{
  if (debug_type == DEBUG_DWARF2)
    {
      char *filename;
      as_where (&filename, &line->line);
      line->filenum = get_filenum (filename, 0);
      line->column = 0;
      line->flags = DWARF2_FLAG_BEGIN_STMT;
    }
  else
    *line = current;
}
Exemplo n.º 3
0
/* Increment the frequency of "word" for the file "fname" in the list
* pointed to by "head".  If the word is in the list, uses the filenames
* array to determine which element of the freq array for that word
* should be incremented. If the word is not in the list, add it in
* alphabetical order and set the frequency of the word in the file
* fname to 1.
*/
Node *add_word(Node *head, char **filenames, char *word, char *fname) {
	Node *cur = head;
	Node *prev = head;
	int filenum = get_filenum(fname, filenames);

	if(cur && (strcmp(cur->word, word)) > 0) {
		head = create_node(word, 1, filenum);
		head->next = cur;
		num_words++;
		return head;
	}

	/* look for the word */
	while(cur != NULL) {
		if((strcmp(cur->word, word)) == 0) {
		/* found word */

			cur->freq[filenum] += 1;
			return head;
		} else if ((strcmp(cur->word, word)) > 0) {
		/* need to insert word */
			if( cur == prev ) { /* we are at the head */
				prev = create_node(word, 1, filenum);
				prev->next = cur;
				num_words++;
				return prev;
			} else {
				prev->next = create_node(word, 1, filenum);
				prev->next->next = cur;
				num_words++;
				return head;
			}
		} 

		prev = cur;
		cur = cur->next;
	}
	if(cur == prev) {
		num_words++;
		return create_node(word, 1, filenum);
	} else {
		if (cur == NULL){ 
			num_words++;
			prev->next = create_node(word, 1, filenum);
		}
		return head;	
	}
}
Exemplo n.º 4
0
void
dwarf2_where (struct dwarf2_line_info *line)
{
  if (debug_type == DEBUG_DWARF2)
    {
      char *filename;
      as_where (&filename, &line->line);
      line->filenum = get_filenum (filename, 0);
      line->column = 0;
      line->flags = DWARF2_FLAG_IS_STMT;
      line->isa = current.isa;
      line->discriminator = current.discriminator;
    }
  else
    *line = current;
}
Exemplo n.º 5
0
/* Increment the frequency of "word" for the file "fname" in the list
 * pointed to by "head".  If the word is in the list, uses the filenames
 * array to determine which element of the freq array for that word
 * should be incremented. If the word is not in the list, add it in
 * alphabetical order and set the frequency of the word in the file
 * fname to 1.
 */
Node *add_word(Node *head, char **filenames, char *word, char *fname) {
    int i = get_filenum(fname, filenames);
    Node *nextNode = get_node(head, word);
   
    // A node for the given word exists.
    if (strcmp(nextNode->word, word) == 0) {
   	nextNode->freq[i] += 1;
	return nextNode;
    }	
   
    // A node for the given word does not exist.
    else {
   	Node *wordNode;
	wordNode = create_node(word, 1, i);
	wordNode->next = nextNode->next;
	nextNode->next = wordNode;
	return wordNode;
    }
}
Exemplo n.º 6
0
char *
dwarf2_directive_file (int dummy ATTRIBUTE_UNUSED)
{
  offsetT num;
  char *filename;
  int filename_len;

  /* Continue to accept a bare string and pass it off.  */
  SKIP_WHITESPACE ();
  if (*input_line_pointer == '"')
    {
      s_app_file (0);
      return NULL;
    }

  num = get_absolute_expression ();
  filename = demand_copy_C_string (&filename_len);
  if (filename == NULL)
    return NULL;
  demand_empty_rest_of_line ();

  if (num < 1)
    {
      as_bad (_("file number less than one"));
      return NULL;
    }

  /* A .file directive implies compiler generated debug information is
     being supplied.  Turn off gas generated debug info.  */
  debug_type = DEBUG_NONE;

  if (num < (int) files_in_use && files[num].filename != 0)
    {
      as_bad (_("file number %ld already allocated"), (long) num);
      return NULL;
    }

  get_filenum (filename, num);

  return filename;
}