osprey-gcc-4.2.0/gcc/protoize.c File Reference

#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "intl.h"
#include "cppdefault.h"
#include <setjmp.h>
#include <signal.h>
#include "version.h"
#include "getopt.h"

Include dependency graph for protoize.c:

Go to the source code of this file.

Data Types

type  string_list
type  hash_table_entry_struct
type  file_info_struct
type  f_list_chain_item_struct
type  def_dec_info_struct

Defines

#define IS_SAME_PATH_CHAR(a, b)   ((a) == (b))
#define IS_SAME_PATH(a, b)   (FILENAME_CMP (a, b) == 0)
#define AUX_INFO_SUFFIX   ".X"
#define SAVE_SUFFIX   ".save"
#define CPLUS_FILE_SUFFIX   "C"
#define NONCONST
#define STANDARD_EXEC_PREFIX   "/usr/local/lib/gcc-lib/"
#define HASH_TABLE_SIZE   (1 << 9)
#define ddip   _info._ddip
#define fip   _info._fip

Typedefs

typedef struct unexpansion_struct unexpansion
typedef struct
hash_table_entry_struct 
hash_table_entry
typedef struct def_dec_info_struct def_dec_info
typedef struct file_info_struct file_info
typedef struct
f_list_chain_item_struct 
f_list_chain_item
typedef hash_table_entry hash_table [HASH_TABLE_SIZE]

Functions/Subroutines

static void usage (void)
static struct string_liststring_list_cons (const char *, struct string_list *)
static int is_syscalls_file (const file_info *)
static void rename_c_file (const hash_table_entry *)
static const def_dec_infofind_extern_def (const def_dec_info *, const def_dec_info *)
static const def_dec_infofind_static_definition (const def_dec_info *)
static void connect_defs_and_decs (const hash_table_entry *)
static void add_local_decl (const def_dec_info *, const char *)
static void add_global_decls (const file_info *, const char *)
static int needs_to_be_converted (const file_info *)
static void visit_each_hash_node (const hash_table_entry *, void(*)(const hash_table_entry *))
static hash_table_entryadd_symbol (hash_table_entry *, const char *)
static hash_table_entrylookup (hash_table_entry *, const char *)
static void free_def_dec (def_dec_info *)
static file_infofind_file (const char *, int)
static void reverse_def_dec_list (const hash_table_entry *)
static void edit_fn_declaration (const def_dec_info *, const char *)
static int edit_formals_lists (const char *, unsigned int, const def_dec_info *)
static void edit_fn_definition (const def_dec_info *, const char *)
static void scan_for_missed_items (const file_info *)
static void edit_file (const hash_table_entry *)
static void notice (const char *cmsgid,...)
static char * savestring (const char *input, unsigned int size)
static char * dupnstr (const char *s, size_t n)
static int safe_read (int desc, void *ptr, int len)
static void safe_write (int desc, void *ptr, int len, const char *out_fname)
static void save_pointers (void)
static void restore_pointers (void)
static int is_id_char (int ch)
static int in_system_include_dir (const char *path)
static int directory_specified_p (const char *name)
static int file_excluded_p (const char *name)
static char * unexpand_if_needed (const char *aux_info_line)
static char * abspath (const char *cwd, const char *rel_filename)
static const char * shortpath (const char *cwd, const char *filename)
static void aux_info_corrupted (void)
static void check_aux_info (int cond)
static const char * find_corresponding_lparen (const char *p)
static int referenced_file_is_newer (const char *l, time_t aux_info_mtime)
static void save_def_or_dec (const char *l, int is_syscalls)
static void munge_compile_params (const char *params_list)
static int gen_aux_info_file (const char *base_filename)
static void process_aux_info_file (const char *base_source_filename, int keep_it, int is_syscalls)
static int identify_lineno (const char *clean_p)
static void declare_source_confusing (const char *clean_p)
static void check_source (int cond, const char *clean_p)
static const char * seek_to_line (int n)
static const char * forward_to_next_token_char (const char *ptr)
static void output_bytes (const char *str, size_t len)
static void output_string (const char *str)
static void output_up_to (const char *p)
static int other_variable_style_function (const char *ansi_header)
static const char * find_rightmost_formals_list (const char *clean_text_p)
static void do_cleaning (char *new_clean_text_base, const char *new_clean_text_limit)
static const char * careful_find_l_paren (const char *p)
static void do_processing (void)
int main (int, char **const)
int main (int argc, char **const argv)

Variables

static const unexpansion unexpansions []
static const int hash_mask = (HASH_TABLE_SIZE - 1)
struct string_listdirectory_list
struct string_listexclude_list
static const char *const other_var_style = "varargs"
static const char * varargs_style_indicator = "va_alist"
static const char * pname
static int errors = 0
static const char * compiler_file_name = "gcc"
int version_flag = 0
int quiet_flag = 0
int nochange_flag = 0
int nosave_flag = 0
int keep_flag = 0
static const char ** compile_params = 0
int local_flag = 0
int global_flag = 0
int cplusplus_flag = 0
static const char * nondefault_syscalls_dir = 0
static int input_file_name_index = 0
static int aux_info_file_name_index = 0
static int n_base_source_files = 0
static const char ** base_source_filenames
static int current_aux_info_lineno
static const char * convert_filename
static const char * invocation_filename
static const char * orig_text_base
static const char * orig_text_limit
static const char * clean_text_base
static const char * clean_text_limit
static const char * clean_read_ptr
static char * repl_text_base
static char * repl_text_limit
static char * repl_write_ptr
static const char * last_known_line_start
static int last_known_line_number
static hash_table filename_primary
static hash_table function_name_primary
static jmp_buf source_confusion_recovery
static char * cwd_buffer
static const char * saved_clean_read_ptr
static char * saved_repl_write_ptr
static struct option longopts []


Define Documentation

#define AUX_INFO_SUFFIX   ".X"

Definition at line 56 of file protoize.c.

#define CPLUS_FILE_SUFFIX   "C"

Definition at line 70 of file protoize.c.

#define ddip   _info._ddip

Definition at line 286 of file protoize.c.

#define fip   _info._fip

Definition at line 287 of file protoize.c.

#define HASH_TABLE_SIZE   (1 << 9)

Definition at line 182 of file protoize.c.

#define IS_SAME_PATH ( a,
b   )     (FILENAME_CMP (a, b) == 0)

Definition at line 50 of file protoize.c.

#define IS_SAME_PATH_CHAR ( a,
b   )     ((a) == (b))

Definition at line 46 of file protoize.c.

#define NONCONST

#define SAVE_SUFFIX   ".save"

Definition at line 63 of file protoize.c.

#define STANDARD_EXEC_PREFIX   "/usr/local/lib/gcc-lib/"


Typedef Documentation

Definition at line 237 of file protoize.c.

Definition at line 239 of file protoize.c.

Definition at line 238 of file protoize.c.

typedef hash_table_entry hash_table[HASH_TABLE_SIZE]

Definition at line 291 of file protoize.c.

Definition at line 233 of file protoize.c.

typedef struct unexpansion_struct unexpansion

Definition at line 164 of file protoize.c.


Function Documentation

static char* abspath ( const char *  cwd,
const char *  rel_filename 
) [static]

static void add_global_decls ( const file_info file_p,
const char *  clean_text_p 
) [static]

static void add_local_decl ( const def_dec_info def_dec_p,
const char *  clean_text_p 
) [static]

static hash_table_entry * add_symbol ( hash_table_entry p,
const char *  s 
) [static]

static void aux_info_corrupted ( void   )  [static]

Definition at line 1301 of file protoize.c.

References exit(), FATAL_EXIT_CODE, and notice().

static const char* careful_find_l_paren ( const char *  p  )  [static]

Definition at line 3753 of file protoize.c.

References check_source(), and q.

static void check_aux_info ( int  cond  )  [static]

Definition at line 1312 of file protoize.c.

References aux_info_corrupted().

static void check_source ( int  cond,
const char *  clean_p 
) [static]

Definition at line 2717 of file protoize.c.

References declare_source_confusing().

static void connect_defs_and_decs ( const hash_table_entry hp  )  [static]

static void declare_source_confusing ( const char *  clean_p  )  [static]

Definition at line 2697 of file protoize.c.

References identify_lineno(), longjmp(), notice(), NULL, and shortpath().

static int directory_specified_p ( const char *  name  )  [static]

Definition at line 819 of file protoize.c.

References IS_DIR_SEPARATOR, string_list::name, string_list::next, p, q, strlen(), and strncmp().

static void do_cleaning ( char *  new_clean_text_base,
const char *  new_clean_text_limit 
) [static]

Definition at line 3649 of file protoize.c.

References gcc_assert, and ISSPACE.

static void do_processing ( void   )  [static]

static char* dupnstr ( const char *  s,
size_t  n 
) [static]

Definition at line 533 of file protoize.c.

References strncpy(), and xmalloc().

static void edit_file ( const hash_table_entry hp  )  [static]

static void edit_fn_declaration ( const def_dec_info def_dec_p,
const char *  clean_text_p 
) [static]

static void edit_fn_definition ( const def_dec_info def_dec_p,
const char *  clean_text_p 
) [static]

static int edit_formals_lists ( const char *  end_formals,
unsigned int  f_list_count,
const def_dec_info def_dec_p 
) [static]

static int file_excluded_p ( const char *  name  )  [static]

Definition at line 845 of file protoize.c.

References IS_DIR_SEPARATOR, len, string_list::name, string_list::next, p, strcmp(), and strlen().

static const char* find_corresponding_lparen ( const char *  p  )  [static]

Definition at line 1323 of file protoize.c.

References q.

static const def_dec_info * find_extern_def ( const def_dec_info head,
const def_dec_info user 
) [static]

static file_info * find_file ( const char *  filename,
int  do_not_stat 
) [static]

Definition at line 1260 of file protoize.c.

References errno, lookup(), notice(), NULL, shortpath(), stat::st_mtime, xmalloc(), and xstrerror().

static const char* find_rightmost_formals_list ( const char *  clean_text_p  )  [static]

Definition at line 3195 of file protoize.c.

References check_source(), forward_to_next_token_char(), ISALPHA, and ISSPACE.

static const def_dec_info * find_static_definition ( const def_dec_info user  )  [static]

static const char* forward_to_next_token_char ( const char *  ptr  )  [static]

Definition at line 2757 of file protoize.c.

References check_source(), and ISSPACE.

static void free_def_dec ( def_dec_info p  )  [static]

static int gen_aux_info_file ( const char *  base_filename  )  [static]

static int identify_lineno ( const char *  clean_p  )  [static]

Definition at line 2683 of file protoize.c.

static int in_system_include_dir ( const char *  path  )  [static]

static int is_id_char ( int  ch  )  [static]

Definition at line 615 of file protoize.c.

References ISIDNUM.

static int is_syscalls_file ( const file_info fi_p  )  [static]

Definition at line 762 of file protoize.c.

References f, strcmp(), and strlen().

static hash_table_entry * lookup ( hash_table_entry hash_tab_p,
const char *  search_symbol 
) [static]

int main ( int argc  ,
char **const   argv 
)

int main ( int  ,
char **  const 
)

Definition at line 1313 of file z8kgen.c.

References op::bits, gas(), op::name, p, printf(), and strcmp().

static void munge_compile_params ( const char *  params_list  )  [static]

static int needs_to_be_converted ( const file_info file_p  )  [static]

static void notice ( const char *  cmsgid,
  ... 
) [static]

Definition at line 508 of file protoize.c.

References _, va_end, va_start, and vfprintf().

static int other_variable_style_function ( const char *  ansi_header  )  [static]

Definition at line 2833 of file protoize.c.

References is_id_char(), len, p, strlen(), and strstr().

static void output_bytes ( const char *  str,
size_t  len 
) [static]

Definition at line 2770 of file protoize.c.

References memcpy, and xrealloc().

static void output_string ( const char *  str  )  [static]

Definition at line 2789 of file protoize.c.

References output_bytes(), and strlen().

static void output_up_to ( const char *  p  )  [static]

Definition at line 2814 of file protoize.c.

References output_bytes().

static void process_aux_info_file ( const char *  base_source_filename,
int  keep_it,
int  is_syscalls 
) [static]

static int referenced_file_is_newer ( const char *  l,
time_t  aux_info_mtime 
) [static]

static void rename_c_file ( const hash_table_entry hp  )  [static]

static void restore_pointers ( void   )  [static]

Definition at line 606 of file protoize.c.

static void reverse_def_dec_list ( const hash_table_entry hp  )  [static]

Definition at line 2308 of file protoize.c.

References if(), next, def_dec_info_struct::next_in_file, NULL, and prev.

static int safe_read ( int  desc,
void ptr,
int  len 
) [static]

Definition at line 546 of file protoize.c.

References errno, and read.

static void safe_write ( int  desc,
void ptr,
int  len,
const char *  out_fname 
) [static]

Definition at line 572 of file protoize.c.

References errno, notice(), NULL, shortpath(), write, and xstrerror().

static void save_def_or_dec ( const char *  l,
int  is_syscalls 
) [static]

static void save_pointers ( void   )  [static]

Definition at line 596 of file protoize.c.

static char* savestring ( const char *  input,
unsigned int  size 
) [static]

Definition at line 521 of file protoize.c.

References strcpy, and xmalloc().

static void scan_for_missed_items ( const file_info file_p  )  [static]

static const char* seek_to_line ( int  n  )  [static]

Definition at line 2739 of file protoize.c.

References check_source(), and gcc_assert.

static const char* shortpath ( const char *  cwd,
const char *  filename 
) [static]

Definition at line 1173 of file protoize.c.

References abspath(), DIR_SEPARATOR, IS_DIR_SEPARATOR, IS_SAME_PATH_CHAR, strlen(), and xmalloc().

static struct string_list * string_list_cons ( const char *  string,
struct string_list rest 
) [static, read]

Definition at line 862 of file protoize.c.

References string_list::name, string_list::next, and xmalloc().

static char* unexpand_if_needed ( const char *  aux_info_line  )  [static]

Definition at line 975 of file protoize.c.

References is_id_char(), len, line_buf, offset, s, savestring(), size, strcpy, strlen(), strncmp(), xmalloc(), and xrealloc().

static void usage ( void   )  [static]

Definition at line 73 of file protoize.c.

static void visit_each_hash_node ( const hash_table_entry hash_tab_p,
void(*)(const hash_table_entry *)  func 
) [static]


Variable Documentation

int aux_info_file_name_index = 0 [static]

Definition at line 399 of file protoize.c.

const char** base_source_filenames [static]

Definition at line 408 of file protoize.c.

const char* clean_read_ptr [static]

Definition at line 449 of file protoize.c.

const char* clean_text_base [static]

Definition at line 439 of file protoize.c.

const char* clean_text_limit [static]

Definition at line 444 of file protoize.c.

const char** compile_params = 0 [static]

Definition at line 379 of file protoize.c.

const char* compiler_file_name = "gcc" [static]

Definition at line 371 of file protoize.c.

const char* convert_filename [static]

Definition at line 418 of file protoize.c.

int cplusplus_flag = 0

Definition at line 386 of file protoize.c.

Definition at line 414 of file protoize.c.

char* cwd_buffer [static]

Definition at line 494 of file protoize.c.

Definition at line 201 of file protoize.c.

int errors = 0 [static]

Definition at line 361 of file protoize.c.

Definition at line 207 of file protoize.c.

Definition at line 481 of file protoize.c.

Definition at line 485 of file protoize.c.

int global_flag = 0

Definition at line 385 of file protoize.c.

const int hash_mask = (HASH_TABLE_SIZE - 1) [static]

Definition at line 186 of file protoize.c.

int input_file_name_index = 0 [static]

Definition at line 395 of file protoize.c.

const char* invocation_filename [static]

Definition at line 424 of file protoize.c.

int keep_flag = 0

Definition at line 378 of file protoize.c.

int last_known_line_number [static]

Definition at line 477 of file protoize.c.

const char* last_known_line_start [static]

Definition at line 471 of file protoize.c.

int local_flag = 0

Definition at line 384 of file protoize.c.

struct option longopts[] [static]

Initial value:

{
  {"version", 0, 0, 'V'},
  {"file_name", 0, 0, 'p'},
  {"quiet", 0, 0, 'q'},
  {"silent", 0, 0, 'q'},
  {"force", 0, 0, 'f'},
  {"keep", 0, 0, 'k'},
  {"nosave", 0, 0, 'N'},
  {"nochange", 0, 0, 'n'},
  {"compiler-options", 1, 0, 'c'},
  {"exclude", 1, 0, 'x'},
  {"directory", 1, 0, 'd'},



  {"local", 0, 0, 'l'},
  {"global", 0, 0, 'g'},
  {"c++", 0, 0, 'C'},
  {"syscalls-dir", 1, 0, 'B'},

  {0, 0, 0, 0}
}

Definition at line 4346 of file protoize.c.

int n_base_source_files = 0 [static]

Definition at line 403 of file protoize.c.

int nochange_flag = 0

Definition at line 375 of file protoize.c.

const char* nondefault_syscalls_dir = 0 [static]

Definition at line 387 of file protoize.c.

int nosave_flag = 0

Definition at line 377 of file protoize.c.

const char* orig_text_base [static]

Definition at line 429 of file protoize.c.

const char* orig_text_limit [static]

Definition at line 434 of file protoize.c.

const char* const other_var_style = "varargs" [static]

Definition at line 221 of file protoize.c.

const char* pname [static]

Definition at line 356 of file protoize.c.

int quiet_flag = 0

Definition at line 374 of file protoize.c.

char* repl_text_base [static]

Definition at line 454 of file protoize.c.

char* repl_text_limit [static]

Definition at line 459 of file protoize.c.

char* repl_write_ptr [static]

Definition at line 465 of file protoize.c.

const char* saved_clean_read_ptr [static]

Definition at line 499 of file protoize.c.

char* saved_repl_write_ptr [static]

Definition at line 504 of file protoize.c.

Definition at line 490 of file protoize.c.

const unexpansion unexpansions[] [static]

Initial value:

 {
  { "struct _iobuf", "FILE" },
  { 0, 0 }
}

Definition at line 173 of file protoize.c.

const char* varargs_style_indicator = "va_alist" [static]

Definition at line 222 of file protoize.c.

int version_flag = 0

Definition at line 373 of file protoize.c.


Generated on Wed Apr 8 15:42:08 2009 for Open64 by  doxygen 1.5.6