本文整理汇总了C++中program_name函数的典型用法代码示例。如果您正苦于以下问题:C++ program_name函数的具体用法?C++ program_name怎么用?C++ program_name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了program_name函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: program_name
void DataFlash_Logger_Program::usage()
{
::printf("Usage:\n");
::printf("%s [OPTION] [FILE]\n", program_name());
::printf(" -c filepath use config file filepath\n");
::printf(" -h display usage information\n");
::printf(" -d debug mode\n");
::printf("\n");
::printf("Example: %s\n", program_name());
exit(0);
}
示例2: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<TYPE>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<TYPE>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<TYPE>(ctx, source);
// fully parametrized kernels:
generate_asbs(source, numeric_string);
generate_scalar_swap(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例3: WinMain
int PASCAL
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpszCmdLine, int nCmdShow)
{ char * argv[100];
int argc;
program = program_name(hInstance);
argc = breakargs(program, lpszCmdLine, argv);
bind_terminal();
PL_set_prolog_flag("verbose", PL_ATOM, "silent"); /* operate silently */
DEBUG(ok("About to start Prolog with %d arguments", argc));
if ( !PL_initialise(argc, argv) )
{ ok("Initialisation failed");
PL_halt(1);
}
if ( PL_toplevel() )
{ PL_halt(0);
} else
{ ok("Toplevel failed");
PL_halt(1);
}
return 0;
}
示例4: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// only generate for floating points (forces error for integers)
if (numeric_string == "float" || numeric_string == "double")
{
generate_nmf_el_wise_mul_div(source, numeric_string);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例5: init
static void init(Context& ctx)
{
static std::map<void*, bool> init_done;
if (!init_done[ctx.handle().get()])
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT, Context>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
std::string source;
source.reserve(2048);
viennacl::ocl::append_double_precision_pragma<double>( ctx.current_device().double_support_extension(), source);
generate_amg_influence_trivial(source);
generate_amg_pmis2_init_workdata(source);
generate_amg_pmis2_max_neighborhood(source);
generate_amg_pmis2_mark_mis_nodes(source);
generate_amg_pmis2_reset_state(source);
generate_amg_agg_propagate_coarse_indices(source);
generate_amg_agg_merge_undecided(source);
generate_amg_agg_merge_undecided_2(source);
generate_amg_interpol_ag(source, numeric_string);
generate_amg_interpol_sa(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例6: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(1024);
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
generate_coordinate_matrix_vec_mul(source, numeric_string);
generate_coordinate_matrix_dense_matrix_multiplication(source, numeric_string);
generate_coordinate_matrix_row_info_extractor(source, numeric_string);
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例7: init
static void init(viennacl::ocl::context & ctx)
{
viennacl::ocl::DOUBLE_PRECISION_CHECKER<NumericT>::apply(ctx);
std::string numeric_string = viennacl::ocl::type_to_string<NumericT>::apply();
static std::map<cl_context, bool> init_done;
if (!init_done[ctx.handle().get()])
{
std::string source;
source.reserve(8192);
bool is_row_major = viennacl::is_row_major<F>::value;
viennacl::ocl::append_double_precision_pragma<NumericT>(ctx, source);
// unary operations
if (numeric_string == "float" || numeric_string == "double")
{
generate_matrix_unary_element_ops(source, numeric_string, "acos", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "acosh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "asin", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "asinh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "atan", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "atanh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "ceil", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "cos", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "cosh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "erf", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "erfc", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp2", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "exp10", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "fabs", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "floor", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log2", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "log10", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "round", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "rsqrt", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sign", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sin", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sinh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "sqrt", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "tan", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "tanh", is_row_major);
generate_matrix_unary_element_ops(source, numeric_string, "trunc", is_row_major);
}
else
{
generate_matrix_unary_element_ops(source, numeric_string, "abs", is_row_major);
}
std::string prog_name = program_name();
#ifdef VIENNACL_BUILD_INFO
std::cout << "Creating program " << prog_name << std::endl;
#endif
ctx.add_program(source, prog_name);
init_done[ctx.handle().get()] = true;
} //if
} //init
示例8: error
void error(char *fmt, ...)
{
va_list ap;
fprintf(stderr, "%s: ", program_name());
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
}
示例9: start_logging
void
start_logging()
{
const char *ident = program_name();
int logopt = LOG_PID | LOG_CONS;
int facility = LOG_USER;
openlog(ident, logopt, facility);
psOSCd_log("psOSCd logging started\n");
}
示例10: main
int
main (int argc, char *argv [])
{
if (argc < 2)
{
printf ("\nUsage : %s <input sound file>\n\n", program_name (argv [0])) ;
printf (" Using %s.\n\n", sf_version_string ()) ;
#if (OS_IS_WIN32 == 1)
printf ("This is a Unix style command line application which\n"
"should be run in a MSDOS box or Command Shell window.\n\n") ;
printf ("Sleeping for 5 seconds before exiting.\n\n") ;
Sleep (5 * 1000) ;
#endif
return 1 ;
} ;
#if defined (__ANDROID__)
puts ("*** Playing sound not yet supported on Android.") ;
puts ("*** Please feel free to submit a patch.") ;
return 1 ;
#elif defined (__linux__)
#if HAVE_ALSA_ASOUNDLIB_H
if (access ("/proc/asound/cards", R_OK) == 0)
alsa_play (argc, argv) ;
else
#endif
opensoundsys_play (argc, argv) ;
#elif defined (__FreeBSD_kernel__) || defined (__FreeBSD__)
opensoundsys_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__) && OSX_DARWIN_VERSION <= 11)
macosx_play (argc, argv) ;
#elif HAVE_SNDIO_H
sndio_play (argc, argv) ;
#elif (defined (sun) && defined (unix))
solaris_play (argc, argv) ;
#elif (OS_IS_WIN32 == 1)
win32_play (argc, argv) ;
#elif (defined (__MACH__) && defined (__APPLE__) && OSX_DARWIN_VERSION > 11)
printf ("OS X 10.8 and later have a new Audio API.\n") ;
printf ("Someone needs to write code to use that API.\n") ;
return 1 ;
#elif defined (__BEOS__)
printf ("This program cannot be compiled on BeOS.\n") ;
printf ("Instead, compile the file sfplay_beos.cpp.\n") ;
return 1 ;
#else
puts ("*** Playing sound not yet supported on this platform.") ;
puts ("*** Please feel free to submit a patch.") ;
return 1 ;
#endif
return 0 ;
} /* main */
示例11: fatal_error
void fatal_error(char *fmt, ...)
{
va_list ap;
fprintf(stderr, "%s: ", program_name());
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
exit(1);
/* NOT REACHED */
}
示例12: main
int
main (int argc, char *argv [])
{ progname = program_name (argv [0]) ;
if (argc != 3)
usage_exit () ;
filename1 = argv [argc - 2] ;
filename2 = argv [argc - 1] ;
if (strcmp (filename1, filename2) == 0)
{ printf ("Error : Input filenames are the same.\n\n") ;
usage_exit () ;
} ;
return compare () ;
} /* main */
示例13: main
int
main (int argc, char *argv [])
{ SNDFILE *file ;
SF_INFO sfinfo ;
SF_BROADCAST_INFO_2K binfo ;
const char *progname ;
const char * filename = NULL ;
int start ;
/* Store the program name. */
progname = program_name (argv [0]) ;
/* Check if we've been asked for help. */
if (argc <= 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
usage_exit (progname, 0) ;
if (argv [argc - 1][0] != '-')
{ filename = argv [argc - 1] ;
start = 1 ;
}
else if (argv [1][0] != '-')
{ filename = argv [1] ;
start = 2 ;
}
else
{ printf ("Error : Either the first or the last command line parameter should be a filename.\n\n") ;
exit (1) ;
} ;
/* Get the time in case we need it later. */
memset (&sfinfo, 0, sizeof (sfinfo)) ;
if ((file = sf_open (filename, SFM_READ, &sfinfo)) == NULL)
{ printf ("Error : Open of file '%s' failed : %s\n\n", filename, sf_strerror (file)) ;
exit (1) ;
} ;
memset (&binfo, 0, sizeof (binfo)) ;
if (sf_command (file, SFC_GET_BROADCAST_INFO, &binfo, sizeof (binfo)) == 0)
memset (&binfo, 0, sizeof (binfo)) ;
process_args (file, &binfo, argc - 2, argv + start) ;
sf_close (file) ;
return 0 ;
} /* main */
示例14: program_name
void
CommandLine::print_usage(const char* extra) const
{
std::cout << "usage: " << program_name() <<
" [-s server_addr] [-u user] [-p password] " <<
(extra ? extra : "") << std::endl;
std::cout << std::endl;
std::cout << " If no options are given, connects to database "
"server on localhost" << std::endl;
std::cout << " using your user name and no password." << std::endl;
if (extra && (strlen(extra) > 0)) {
std::cout << std::endl;
std::cout << " The extra parameter " << extra <<
" is required, regardless of which" << std::endl;
std::cout << " other arguments you pass." << std::endl;
}
std::cout << std::endl;
}
示例15: main
int
main (int argc, char *argv [])
{ int k ;
print_version () ;
if (argc < 2 || strcmp (argv [1], "--help") == 0 || strcmp (argv [1], "-h") == 0)
{ usage_exit (program_name (argv [0])) ;
return 1 ;
} ;
if (strcmp (argv [1], "-i") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
error += instrument_dump (argv [k]) ;
return error ;
} ;
if (strcmp (argv [1], "-b") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
error += broadcast_dump (argv [k]) ;
return error ;
} ;
if (strcmp (argv [1], "-c") == 0)
{ int error = 0 ;
for (k = 2 ; k < argc ; k++)
error += chanmap_dump (argv [k]) ;
return error ;
} ;
for (k = 1 ; k < argc ; k++)
info_dump (argv [k]) ;
if (argc > 2)
total_dump () ;
return 0 ;
} /* main */