Esempio n. 1
0
int main ()
{
  printf ("Results of parse_resolve3_test:\n");
  
  try
  {
    Parser parser (file_name);
    PropertyMap properties;
    
    properties.SetProperty ("A.D", "Hello");

    printf ("Parse successfull\n");
    
    ParseNode root = resolve_references (parser.Root (), properties);

    print (root, 0);

    parser.Log ().Print (&print_log);    
  }
  catch (std::exception& e)
  {
    printf ("exception: %s\n", e.what ());
  }

  return 0;
}
Esempio n. 2
0
int main(int argc, char **argv)
{
   fprintf( stdout, header );

   DEBUG(( stderr, "main: parsing command line\n" ));
   if( parse_cmdline( argc, argv, options, countof(options) ) ) goto bail_out;
   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   if( linker_options & OPT_SHOW_HELP )
   {
      help_msg( help_head, help_tail, options, countof(options) );
      goto bail_out;
   }

   if( !root_obj ) { error( "no input files" ); goto bail_out; }

   if( arrange_sections() ) goto bail_out;
   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   adjust_symbols_values();
   register_symbols();
   resolve_references();

   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   apply_relocations();

   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   if( !(linker_options & OPT_MAKE_ORB) ) generate_mt();

   if( errors || warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   output_sections( output_filename );
   if( !(linker_options & OPT_MAKE_ORB) ) output_metadata( output_filename );
   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) goto bail_out;

   if( linker_options & OPT_XREF ) produce_xrefs( output_filename );

   if( errors || (warnings && (linker_options & OPT_ABORT_ON_WARN)))
      remove(output_filename);
   else if( linker_options & OPT_VERBOSE )
   {
      fprintf(stdout, "\n"
                      "******************************************************\n"
                      "** %s\n"
                      "**\n",
                      output_filename );

      if( linker_options & OPT_MAKE_ORB )
         fprintf( stdout, "** ORB generated as:\n" );
      else
         fprintf( stdout, "** Component generated as:\n" );

      fprintf(stdout, "** Text at 0x%08x, size 0x%08x\n"
                      "** Data at 0x%08x, size 0x%08x\n"
                      "** BSS  at 0x%08x, size 0x%08x\n",
                      comp.text.start, comp.text.size,
                      comp.data.start, comp.data.size,
                      comp.bss.start,  comp.bss.size
             );

      if( !(linker_options & OPT_MAKE_ORB) )
         fprintf( stdout, "** MTbl at 0x%08x, size 0x%08x\n", comp.mt.start, comp.mt.size );

      fprintf(stdout, "******************************************************\n"
                      "\n" );
   }

bail_out:
   //global_destruction(); // who cares? we exit anyway...

   if( errors || warnings )
      fprintf( stderr, "exiting with %d error(s), %d warning(s)\n", errors, warnings );

   if( warnings && (linker_options & OPT_ABORT_ON_WARN) ) return errors + warnings;

   return errors;
}
ParseNode resolve_references (const ParseNode& source_tree, const PropertyMap& reference_values)
{
  return resolve_references (source_tree, PropertyMapResolver (reference_values));
}
ParseNode resolve_references (const ParseNode& source_tree, const ParseNode& reference_values)
{
  return resolve_references (source_tree, ParseNodeResolver (reference_values));
}