コード例 #1
0
string_abstractiont::string_abstractiont(
  symbol_tablet &_symbol_table,
  message_handlert &_message_handler):
  message_streamt(_message_handler),
  arg_suffix("#strarg"),
  sym_suffix("#str$fcn"),
  symbol_table(_symbol_table),
  ns(_symbol_table),
  temporary_counter(0)
{
  struct_typet s;

  s.components().resize(3);

  s.components()[0].set_name("is_zero");
  s.components()[0].set_pretty_name("is_zero");
  s.components()[0].type()=build_type(IS_ZERO);

  s.components()[1].set_name("length");
  s.components()[1].set_pretty_name("length");
  s.components()[1].type()=build_type(LENGTH);

  s.components()[2].set_name("size");
  s.components()[2].set_pretty_name("size");
  s.components()[2].type()=build_type(SIZE);

  string_struct=s;
}
コード例 #2
0
ファイル: version.cpp プロジェクト: NOMORECOFFEE/hpx
    std::string complete_version()
    {
        boost::format logo(
            "Versions:\n"
            "  HPX: %s\n"
            "  Boost: %s\n"
#if defined(HPX_HAVE_HWLOC)
            "  Hwloc: %s\n"
#endif
            "\n"
            "Build:\n"
            "  Type: %s\n"
            "  Date: %s\n"
            "  Platform: %s\n"
            "  Compiler: %s\n"
            "  Standard Library: %s");

        return boost::str(logo %
            build_string() %
            boost_version() %
#if defined(HPX_HAVE_HWLOC)
            hwloc_version() %
#endif
            build_type() %
            build_date_time() %
            boost_platform() %
            boost_compiler() %
            boost_stdlib());
    }
コード例 #3
0
 // Returns the HPX full build information string.
 std::string full_build_string()
 {
     hpx::util::osstream strm;
     strm << "{version}: " << build_string() << "\n"
          << "{boost}: " << boost_version() << "\n"
          << "{build-type}: " << build_type() << "\n"
          << "{date}: " << build_date_time() << "\n"
          << "{platform}: " << boost_platform() << "\n"
          << "{compiler}: " << boost_compiler() << "\n"
          << "{stdlib}: " << boost_stdlib() << "\n";
     return util::osstream_get_string(strm);
 }
コード例 #4
0
ファイル: BuildInfo.cpp プロジェクト: Peita/coolfluid3
std::string BuildInfo::version_header() const
{
  std::ostringstream out;

  out << "Release      : " << release_version() << "\n";
  out << "Kernel       : " << kernel_version()  << "\n";
  out << "Build System : " << build_tool()    << "\n";
  out << "Build Type   : " << build_type()      << "\n";
  out << "Build OS     : " << os_long_name() << " [" << os_bits() << "bits]\n";
  out << "Build CPU    : " << build_processor() << "\n";

  return out.str();
}
コード例 #5
0
ファイル: version.cpp プロジェクト: NextGenIntelligence/hpx
    // Returns the HPX full build information string.
    std::string full_build_string()
    {
        std::ostringstream strm;
        strm << "{config}:\n" << configuration_string()
             << "{version}: " << build_string() << "\n"
             << "{boost}: " << boost_version() << "\n"
             << "{build-type}: " << build_type() << "\n"
             << "{date}: " << build_date_time() << "\n"
             << "{platform}: " << boost_platform() << "\n"
             << "{compiler}: " << boost_compiler() << "\n"
             << "{stdlib}: " << boost_stdlib() << "\n";

        return strm.str();
    }
コード例 #6
0
ファイル: version.cpp プロジェクト: NextGenIntelligence/hpx
    std::string complete_version()
    {
        boost::format logo(
            "Versions:\n"
            "  HPX: %s\n"
            "  Boost: %s\n"
#if defined(HPX_HAVE_HWLOC)
            "  Hwloc: %s\n"
#endif
#if defined(HPX_HAVE_PARCELPORT_MPI)
            "  MPI: %s\n"
#endif
            "\n"
            "Build:\n"
            "  Type: %s\n"
            "  Date: %s\n"
            "  Platform: %s\n"
            "  Compiler: %s\n"
            "  Standard Library: %s\n");

        std::string version = boost::str(logo %
            build_string() %
            boost_version() %
#if defined(HPX_HAVE_HWLOC)
            hwloc_version() %
#endif
#if defined(HPX_HAVE_PARCELPORT_MPI)
            mpi_version() %
#endif
            build_type() %
            build_date_time() %
            boost_platform() %
            boost_compiler() %
            boost_stdlib());

#if defined(HPX_HAVE_MALLOC)
            version += "  Allocator: " + malloc_version() + "\n";
#endif

            return version;
    }
コード例 #7
0
    std::string complete_version()
    {
        boost::format logo(
            "Versions:\n"
            "  HPX: %s\n"
            "  Boost: %s\n"
            "\n"
            "Build:\n"
            "  Type: %s\n"
            "  Date: %s\n"
            "  Platform: %s\n"
            "  Compiler: %s\n"
            "  Standard Library: %s\n");

        return boost::str(logo %
            build_string() %
            boost_version() %
            build_type() %
            build_date_time() %
            boost_platform() %
            boost_compiler() %
            boost_stdlib());
    }
コード例 #8
0
ファイル: misc.c プロジェクト: funny-falcon/lwc
Token *build_type (typeID t, Token o, Token ret[]) 
{
/* XXX: elliptics */
	if (is_reference (t))
		t = ptrdown (dereference (t));

	Token tmp [100], *dcls = &tmp [20], *dcle = dcls;
	Token *st = open_typeID (t);
	int i = 1, b = 0;

	if (o) {
		*(++dcle) = -1;
		*dcls-- = o;
	} else  *dcls-- = -1;

	for (;;i++) {
		switch (st [i]) {
		case '*':
			*dcls-- = '*';
			b = 1;
			continue;
		case '[':
			if (b) *dcls-- = '(', *dcle++ = ')', b = 0;
			*dcle++ = '['; *dcle++ = ']';
			continue;
		case '(':
			if (b) *dcls-- = '(', *dcle++ = ')', b = 0;
			*dcle++ = '(';
			for (i++;;)
				if (st [i] == B_ELLIPSIS) {
					*dcle++ = ELLIPSIS;
					break;
				} else {
					if (st [i] == INTERNAL_ARGEND) break;
					Token arg [50];
					intcpy (dcle, build_type (st [i++], 0, arg));
					dcle += intlen (dcle);
					*dcle++ = ',';
				}
			if (dcle [-1] == ',') --dcle;
			*dcle++ = ')';
			continue;
		case -1: break;
		default: PRINTF ("UNKNWOWN %i\n", st [i]);
		}
		break;
	}
	*dcle = -1;

	if (st [0] >= 0)
		if (ISSYMBOL (st [0])) sintprintf (ret, st [0], -1);
		else sintprintf (ret, isunion (st [0]) ? RESERVED_union : iRESERVED_struct (st [0]),
			    name_of_struct (st [0]), -1);
	else switch (st [0]) {
	 case B_UCHAR:  sintprintf (ret, RESERVED_unsigned, RESERVED_char, -1);
	ncase B_SCHAR:  sintprintf (ret, RESERVED_char, -1);
	ncase B_USINT:  sintprintf (ret, RESERVED_unsigned, RESERVED_short, RESERVED_int, -1);
	ncase B_SSINT:  sintprintf (ret, RESERVED_short, RESERVED_int, -1);
	ncase B_UINT:   sintprintf (ret, RESERVED_unsigned, RESERVED_int, -1);
	ncase B_SINT:   sintprintf (ret, RESERVED_int, -1);
	ncase B_ULONG:  sintprintf (ret, RESERVED_unsigned, RESERVED_long, -1);
	ncase B_SLONG:  sintprintf (ret, RESERVED_long, -1);
	ncase B_ULLONG: sintprintf (ret, RESERVED_unsigned, RESERVED_long, RESERVED_long, -1);
	ncase B_SLLONG: sintprintf (ret, RESERVED_long, RESERVED_long, -1);
	ncase B_FLOAT:  sintprintf (ret, RESERVED_float, -1);
	ncase B_DOUBLE: sintprintf (ret, RESERVED_double, -1);
	ncase B_VOID:   sintprintf (ret, RESERVED_void, -1);
	}

	intcat (ret, dcls + 1);

	return ret;
}
コード例 #9
0
ファイル: plugin.cpp プロジェクト: heyfluke/gen-trace
static unsigned int
execute_trace ()
{
    gimple_seq body, body_bind_body, inner_cleanup, outer_cleanup;
    gimple inner_try, outer_try;
    tree record_type, func_start_decl, func_end_decl, var_decl,
         function_name_decl, constructor_clobber;
    gimple call_func_start;
    gimple_stmt_iterator gsi;

    // build record type
    record_type = build_type ();
    // build start & end function decl
    func_start_decl = build_function_decl ("__start_ctrace__", record_type);
    func_end_decl = build_function_decl ("__end_ctrace__", record_type);
    // init variables of current body
    body = gimple_body (current_function_decl);

    var_decl = build_decl (UNKNOWN_LOCATION, VAR_DECL,
                           get_identifier ("__ctrace_var__"), record_type);
    DECL_CONTEXT (var_decl) = current_function_decl;
    TREE_ADDRESSABLE (var_decl) = 1;
    declare_vars (var_decl, body, false);
    TREE_USED (var_decl) = 1;
    // mimic __FUNCTION__ builtin.
    function_name_decl = make_fname_decl ();
    declare_vars (function_name_decl, body, false);
    // construct inner try
    // init calls
    call_func_start = gimple_build_call (
                          func_start_decl, 2,
                          build1 (ADDR_EXPR, build_pointer_type (record_type), var_decl),
                          build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (function_name_decl)),
                                  function_name_decl));
    // make inner clean up
    inner_cleanup = gimple_build_call (
                        func_end_decl, 2,
                        build1 (ADDR_EXPR, build_pointer_type (record_type), var_decl),
                        build1 (ADDR_EXPR, build_pointer_type (TREE_TYPE (function_name_decl)),
                                function_name_decl));
    // update inner try
    body_bind_body = gimple_bind_body (body);
    inner_try
        = gimple_build_try (body_bind_body, inner_cleanup, GIMPLE_TRY_FINALLY);
    gsi = gsi_start (inner_try);
    gsi_insert_before (&gsi, call_func_start, GSI_NEW_STMT);
    // construct outer try
    constructor_clobber = make_node (CONSTRUCTOR);
    TREE_THIS_VOLATILE (constructor_clobber) = 1;
    TREE_TYPE (constructor_clobber) = TREE_TYPE (var_decl);
    outer_cleanup = gimple_build_assign (var_decl, constructor_clobber);
    // update outer try
    outer_try
        = gimple_build_try (call_func_start, outer_cleanup, GIMPLE_TRY_FINALLY);
    // update body bind body
    gimple_bind_set_body (body, outer_try);
    if (dump_file)
    {
        dump_function_to_file (current_function_decl, dump_file,
                               TDF_TREE | TDF_BLOCKS | TDF_VERBOSE);
    }
    // exit (0);
    return 0;
}
コード例 #10
0
ファイル: exception.cpp プロジェクト: Stevejohntest/hpx
    ///////////////////////////////////////////////////////////////////////////
    // Extract the diagnostic information embedded in the given exception and
    // return a string holding a formatted message.
    std::string diagnostic_information(boost::exception const& e)
    {
        util::osstream strm;
        strm << "\n";

        std::string const* back_trace =
            boost::get_error_info<hpx::detail::throw_stacktrace>(e);
        if (back_trace && !back_trace->empty()) {
            // FIXME: add indentation to stack frame information
            strm << "[stack_trace]: " << *back_trace << "\n";
        }

        // Try a cast to std::exception - this should handle boost.system
        // error codes in addition to the standard library exceptions.
        std::exception const* se = dynamic_cast<std::exception const*>(&e);
        if (se)
            strm << "[what]: " << se->what() << "\n";

        boost::uint32_t const* locality =
            boost::get_error_info<hpx::detail::throw_locality>(e);
        if (locality)
            strm << "[locality-id]: " << *locality << "\n";

        std::string const* hostname_ =
            boost::get_error_info<hpx::detail::throw_hostname>(e);
        if (hostname_ && !hostname_->empty())
            strm << "[hostname]: " << *hostname_ << "\n";

        boost::int64_t const* pid_ =
            boost::get_error_info<hpx::detail::throw_pid>(e);
        if (pid_ && -1 != *pid_)
            strm << "[process-id]: " << *pid_ << "\n";

        char const* const* func =
            boost::get_error_info<boost::throw_function>(e);
        if (func) {
            strm << "[function]: " << *func << "\n";
        }
        else {
            std::string const* s =
                boost::get_error_info<hpx::detail::throw_function>(e);
            if (s)
                strm << "[function]: " << *s << "\n";
        }

        char const* const* file =
            boost::get_error_info<boost::throw_file>(e);
        if (file) {
            strm << "[file]: " << *file << "\n";
        }
        else {
            std::string const* s =
                boost::get_error_info<hpx::detail::throw_file>(e);
            if (s)
                strm << "[file]: " << *s << "\n";
        }

        int const* line =
            boost::get_error_info<boost::throw_line>(e);
        if (line)
            strm << "[line]: " << *line << "\n";

        std::size_t const* shepherd =
            boost::get_error_info<hpx::detail::throw_shepherd>(e);
        if (shepherd && std::size_t(-1) != *shepherd)
            strm << "[os-thread]: " << *shepherd << "\n";

        std::size_t const* thread_id =
            boost::get_error_info<hpx::detail::throw_thread_id>(e);
        if (thread_id && *thread_id)
            strm << (boost::format("[thread-id]: %016x\n") % *thread_id);

        std::string const* thread_description =
            boost::get_error_info<hpx::detail::throw_thread_name>(e);
        if (thread_description && !thread_description->empty())
            strm << "[thread-description]: " << *thread_description << "\n";

        // add system information
        // FIXME: collect at throw site
        strm << "[version]: " << build_string() << "\n";
        strm << "[boost]: " << boost_version() << "\n";
        strm << "[build-type]: " << build_type() << "\n";
        strm << "[date]: " << build_date_time() << "\n";
        strm << "[platform]: " << boost_platform() << "\n";
        strm << "[compiler]: " << boost_compiler() << "\n";
        strm << "[stdlib]: " << boost_stdlib() << "\n";

        return util::osstream_get_string(strm);
    }