OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gdb/] [gdb-6.8/] [gdb-6.8.openrisc-2.1/] [sim/] [igen/] [table.h] - Diff between revs 24 and 33

Only display areas with differences | Details | Blame | View Log

Rev 24 Rev 33
/* The IGEN simulator generator for GDB, the GNU Debugger.
/* The IGEN simulator generator for GDB, the GNU Debugger.
 
 
   Copyright 2002, 2007, 2008 Free Software Foundation, Inc.
   Copyright 2002, 2007, 2008 Free Software Foundation, Inc.
 
 
   Contributed by Andrew Cagney.
   Contributed by Andrew Cagney.
 
 
   This file is part of GDB.
   This file is part of GDB.
 
 
   This program is free software; you can redistribute it and/or modify
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.
   (at your option) any later version.
 
 
   This program is distributed in the hope that it will be useful,
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   GNU General Public License for more details.
 
 
   You should have received a copy of the GNU General Public License
   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 
 
 
/* Read a table, line by line, from a file.
/* Read a table, line by line, from a file.
 
 
   A table line has several forms:
   A table line has several forms:
 
 
   Field line:
   Field line:
 
 
       <text> { ":" <text> }
       <text> { ":" <text> }
       type == table_colon_entry
       type == table_colon_entry
 
 
       Fields points to a NULL terminated list of pointers.
       Fields points to a NULL terminated list of pointers.
 
 
   Tab indented block:
   Tab indented block:
 
 
     <tab> <text> <nl> { <tab> <text> <nl> }
     <tab> <text> <nl> { <tab> <text> <nl> }
     type == table_code_entry
     type == table_code_entry
 
 
     The leading tab at the start of each line is discarded.
     The leading tab at the start of each line is discarded.
     fields[i] is the i'th line with the <nl> discarded.
     fields[i] is the i'th line with the <nl> discarded.
 
 
 
 
   Code block:
   Code block:
 
 
     "{" <ignore-text> <nl> { <text> <nl> } "}" <ignore-text> <nl>
     "{" <ignore-text> <nl> { <text> <nl> } "}" <ignore-text> <nl>
     type == table_code_entry
     type == table_code_entry
 
 
     The leading/trailing {/} lines are discarded.
     The leading/trailing {/} lines are discarded.
     Lines containing two leading spaces have those spaces striped.
     Lines containing two leading spaces have those spaces striped.
     fields[i] is the i'th line with the <nl> discarded.
     fields[i] is the i'th line with the <nl> discarded.
 
 
   In addition, the table parser reconises and handles internally the
   In addition, the table parser reconises and handles internally the
   following (when not in a code block):
   following (when not in a code block):
 
 
     "#" <line-nr> '"' <file> '"'
     "#" <line-nr> '"' <file> '"'
 
 
     As per CPP/CC, treat following lines as if they were taken from
     As per CPP/CC, treat following lines as if they were taken from
     <file> starting at <line-nr>
     <file> starting at <line-nr>
 
 
   No support for CPP's "#if/#else/#endif" style conditions are
   No support for CPP's "#if/#else/#endif" style conditions are
   planned. */
   planned. */
 
 
typedef struct _table table;
typedef struct _table table;
 
 
typedef enum
typedef enum
{
{
  table_colon_entry,
  table_colon_entry,
  table_code_entry,
  table_code_entry,
}
}
table_entry_type;
table_entry_type;
 
 
 
 
typedef struct _table_entry table_entry;
typedef struct _table_entry table_entry;
struct _table_entry
struct _table_entry
{
{
  table *file;
  table *file;
  line_ref *line;
  line_ref *line;
  table_entry_type type;
  table_entry_type type;
  int nr_fields;
  int nr_fields;
  char **field;
  char **field;
};
};
 
 
/* List of directories to search when opening a pushed file.  Current
/* List of directories to search when opening a pushed file.  Current
   directory is always searched first */
   directory is always searched first */
typedef struct _table_include table_include;
typedef struct _table_include table_include;
struct _table_include
struct _table_include
{
{
  char *dir;
  char *dir;
  table_include *next;
  table_include *next;
};
};
 
 
 
 
/* Open/read a table file.  Since the file is read once during open
/* Open/read a table file.  Since the file is read once during open
   (and then closed immediatly) there is no close method. */
   (and then closed immediatly) there is no close method. */
 
 
extern table *table_open (const char *file_name);
extern table *table_open (const char *file_name);
 
 
extern table_entry *table_read (table *file);
extern table_entry *table_read (table *file);
 
 
 
 
/* Push the the state of the current file and open FILE_NAME.  When
/* Push the the state of the current file and open FILE_NAME.  When
   the end of FILE_NAME is reached, return to the pushed file */
   the end of FILE_NAME is reached, return to the pushed file */
 
 
extern void table_push
extern void table_push
  (table *file, line_ref *line, table_include *search, const char *file_name);
  (table *file, line_ref *line, table_include *search, const char *file_name);
 
 
 
 
/* Expand the specified field_nr using the internal expansion table.
/* Expand the specified field_nr using the internal expansion table.
   A field is only expanded when explicitly specified.  */
   A field is only expanded when explicitly specified.  */
 
 
extern void table_expand_field (table_entry *entry, int field_nr);
extern void table_expand_field (table_entry *entry, int field_nr);
 
 
 
 
/* Given a code entry, write the code to FILE.  Since any
/* Given a code entry, write the code to FILE.  Since any
   leading/trailing braces were striped as part of the read, they are
   leading/trailing braces were striped as part of the read, they are
   not written. */
   not written. */
 
 
extern void table_print_code (lf *file, table_entry *entry);
extern void table_print_code (lf *file, table_entry *entry);
 
 
 
 
/* Debugging */
/* Debugging */
 
 
extern void dump_line_ref
extern void dump_line_ref
  (lf *file, char *prefix, const line_ref *line, char *suffix);
  (lf *file, char *prefix, const line_ref *line, char *suffix);
 
 
extern void dump_table_entry
extern void dump_table_entry
  (lf *file, char *prefix, const table_entry *entry, char *suffix);
  (lf *file, char *prefix, const table_entry *entry, char *suffix);
 
 
 
 
 
 
/* Utilities for skipping around text */
/* Utilities for skipping around text */
 
 
extern char *skip_digits (char *chp);
extern char *skip_digits (char *chp);
 
 
extern char *skip_spaces (char *chp);
extern char *skip_spaces (char *chp);
 
 
extern char *skip_to_separator (char *chp, char *separators);
extern char *skip_to_separator (char *chp, char *separators);
 
 
extern char *back_spaces (char *start, char *chp);
extern char *back_spaces (char *start, char *chp);
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.