本文整理汇总了C++中set_defaults函数的典型用法代码示例。如果您正苦于以下问题:C++ set_defaults函数的具体用法?C++ set_defaults怎么用?C++ set_defaults使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_defaults函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: global_setup
static void
global_setup (void)
{
setup_stack (&parse_stack, parse_stack_buffer,
sizeof (parse_stack_buffer));
setup_display ();
setup_sgf ();
set_defaults();
if (configfile_load(SETTINGS_FILENAME, config,
sizeof(config)/sizeof(*config),
SETTINGS_MIN_VERSION ) < 0)
{
/* If the loading failed, save a new config file (as the disk is
already spinning) */
/* set defaults again just in case (don't know if they can ever
* be messed up by configfile_load, and it's basically free anyway)
*/
set_defaults();
configfile_save(SETTINGS_FILENAME, config,
sizeof(config)/sizeof(*config),
SETTINGS_VERSION);
}
}
示例2: main123
/*
* main:
* -----
*/
int main123(int argc, char **argv)
{
time_t end_time;
int raw = 0;
int mono_from_stereo = 0;
printf("Shine v1.08 19/06/03\n");
time(&config.start_time);
set_defaults();
if (!parse_command(argc, argv, &raw, &mono_from_stereo))
print_usage();
wave_open(raw, mono_from_stereo); /* prints wave (input) configuration */
check_config(); /* prints mpeg (output) configuration */
printf("Encoding \"%s\" to \"%s\"\n", config.infile, config.outfile);
L3_compress();
wave_close();
time(&end_time);
end_time -= config.start_time;
printf(" Finished in %2ld:%2ld:%2ld\n",
end_time/3600,(end_time/60)%60,end_time%60);
return 0;
}
示例3: main
int main(int argc, char **argv) {
int num_iters;
#if (NUMTESTS > 0)
int i;
double time;
double time_per;
#endif
set_defaults();
setup_indexing();
load_default_data();
/* Solve problem instance for the record. */
settings.verbose = 1;
num_iters = solve();
#ifndef ZERO_LIBRARY_MODE
#if (NUMTESTS > 0)
/* Now solve multiple problem instances for timing purposes. */
settings.verbose = 0;
tic();
for (i = 0; i < NUMTESTS; i++) {
solve();
}
time = tocq();
printf("Timed %d solves over %.3f seconds.\n", NUMTESTS, time);
time_per = time / NUMTESTS;
if (time_per > 1) {
printf("Actual time taken per solve: %.3g s.\n", time_per);
} else if (time_per > 1e-3) {
printf("Actual time taken per solve: %.3g ms.\n", 1e3*time_per);
} else {
printf("Actual time taken per solve: %.3g us.\n", 1e6*time_per);
}
#endif
#endif
return 0;
}
示例4: main
int main(int argc, char **argv)
{
int i;
char buffer[MAXBUFSIZE];
int done=0;
set_defaults();
handle_args(argc, argv, 0);
srand(time(NULL));
if(num_clients < 1)
FATALERR("More than 1 node is required to run\n");
// Capture exit signals to safetly close the program
signal(SIGINT, signal_handler);
signal(SIGTERM, signal_handler);
signal(SIGABRT, signal_handler);
// If there was no ip address set in the command line, listen for a broadcast from the server
if(server_addr.sin_addr.s_addr == 0)
{
setup_listen_socket();
obtain_server();
}
// Attempt to create a TCP connection to the server
if(!connectTCP())
QUIT();
send_data();
signal_handler(0);
}
示例5: main
int main(int argc, char** argv)
{
set_defaults();
parse_options(argc, argv);
if (conf.help_flag) {
print_help();
exit(0);
}
check_conf();
unsigned int arr_width = conf.width * conf.multiplier;
unsigned int arr_height = conf.height * conf.multiplier;
printf("Creating array size of %ux%u.\n", arr_width, arr_height);
Array* arr = new_array(arr_width, arr_height);
printf("Initializing with side temps of %f, %f, %f, %f.\n",
conf.top_temp, conf.right_temp, conf.bottom_temp, conf.left_temp);
initialize_array(arr, conf.top_temp, conf.right_temp, conf.bottom_temp, conf.left_temp);
printf("Searching for temp balance with max iterations of %d.\n", conf.max_iters);
double mean_temp = calculate_heatconduct(arr, conf.max_iters);
printf("Mean temperature: %f\n", mean_temp);
return 0;
}
示例6: read_config
static gboolean
read_config (GtkFileChooserSettings *settings,
GError **error)
{
char *filename;
char *contents;
gsize contents_len;
gboolean success;
filename = get_config_filename ();
success = g_file_get_contents (filename, &contents, &contents_len, error);
g_free (filename);
if (!success)
{
set_defaults (settings);
return FALSE;
}
success = parse_config (settings, contents, error);
g_free (contents);
return success;
}
示例7: init
static AS3_Val init(void * self, AS3_Val args)
{
void * ref;
void * src;
void * dest;
AS3_ArrayValue(args, "AS3ValType, AS3ValType, AS3ValType", &ref, &src, &dest);
flashErrorsRef = (AS3_Val)ref;
config.wave.file = funopen((void *)src, readByteArray, writeByteArray, seekByteArray, closeByteArray);
config.wave.output = funopen((void *)dest, readByteArray, writeByteArray, seekByteArray, closeByteArray);
if (config.wave.file == NULL || config.wave.output == NULL) {
ERROR("Unable to set bytes arrays");
}
wave_open();
set_defaults();
check_config();
start_compress();
return AS3_Int(1);
}
示例8: mca_base_open
/*
* Main MCA initialization.
*/
int mca_base_open(void)
{
int param_index;
char *value;
opal_output_stream_t lds;
char hostname[64];
if (!mca_base_opened) {
mca_base_opened = true;
} else {
return OPAL_SUCCESS;
}
/* Register some params */
#if OMPI_WANT_HOME_CONFIG_FILES
asprintf(&value, "%s%c%s"OPAL_PATH_SEP".openmpi"OPAL_PATH_SEP"components", opal_install_dirs.pkglibdir, OPAL_ENV_SEP, opal_home_directory() );
#else
# if defined(__WINDOWS__) && defined(_DEBUG)
asprintf(&value, "%s/debug", opal_install_dirs.pkglibdir);
# else
asprintf(&value, "%s", opal_install_dirs.pkglibdir);
# endif
#endif
mca_base_param_component_path =
mca_base_param_reg_string_name("mca", "component_path",
"Path where to look for Open MPI and ORTE components",
false, false, value, NULL);
free(value);
param_index = mca_base_param_reg_string_name("mca", "verbose",
"Top-level verbosity parameter",
false, false, NULL, NULL);
mca_base_param_reg_int_name("mca", "component_show_load_errors",
"Whether to show errors for components that failed to load or not",
false, false, 1, NULL);
mca_base_param_reg_int_name("mca", "component_disable_dlopen",
"Whether to attempt to disable opening dynamic components or not",
false, false, 0, NULL);
/* What verbosity level do we want? */
mca_base_param_lookup_string(param_index, &value);
memset(&lds, 0, sizeof(lds));
if (NULL != value) {
parse_verbose(value, &lds);
free(value);
} else {
set_defaults(&lds);
}
gethostname(hostname, 64);
asprintf(&lds.lds_prefix, "[%s:%05d] ", hostname, getpid());
opal_output_reopen(0, &lds);
opal_output_verbose(5, 0, "mca: base: opening components");
free(lds.lds_prefix);
/* Open up the component repository */
return mca_base_component_repository_init();
}
示例9: sh_utmp_end
int sh_utmp_end ()
{
struct log_user * user = userlist;
struct log_user * userold;
SL_ENTER(_("sh_utmp_end"));
while (user)
{
userold = user;
user = user->next;
SH_FREE(userold);
}
userlist = NULL;
#ifdef HAVE_UTTYPE
(void) sh_utmp_login_clean();
#endif
/* Reset the flag, such that the module
* can be re-enabled.
*/
set_defaults();
init_done = 0;
#if defined(HAVE_PTHREAD)
sh_inotify_remove(&inotify_watch);
#endif
SL_RETURN( (0), _("sh_utmp_end"));
}
示例10: main
int
main(int argc, char *argv[])
{
int result;
struct fuse_args args = FUSE_ARGS_INIT(argc, argv);
memset(&stormfs, 0, sizeof(struct stormfs));
stormfs.progname = argv[0];
stormfs.service = AMAZON;
set_defaults();
if(fuse_opt_parse(&args, &stormfs, stormfs_opts, stormfs_opt_proc) == -1) {
fprintf(stderr, "%s: error parsing command-line options\n", stormfs.progname);
exit(EXIT_FAILURE);
}
parse_config(stormfs.config);
validate_config();
if(stormfs.rrs)
stormfs.storage_class = "REDUCED_REDUNDANCY";
stormfs.virtual_url = stormfs_virtual_url(stormfs.url, stormfs.bucket);
g_thread_init(NULL);
result = stormfs_fuse_main(&args);
fuse_opt_free_args(&args);
return result;
}
示例11: graphdefaults
void graphdefaults()
{
set_defaults();
for (int i = 0; i <= MAXCOLORS; i++) {
current_palette.colors[i] = i;
BGIpalette[i] = BGIcolor[i];
}
SetPaletteEntries(hPalette, BG, MAXCOLORS+1, BGIpalette);
RealizePalette(hdc[0]);
SetTextColor(hdc[0], PALETTEINDEX(text_color+BG));
SetTextColor(hdc[1], PALETTEINDEX(text_color+BG));
SetBkColor(hdc[0], PALETTEINDEX(BG));
SetBkColor(hdc[1], PALETTEINDEX(BG));
SelectClipRgn(hdc[0], NULL);
SelectClipRgn(hdc[1], NULL);
SetViewportOrgEx(hdc[0], 0, 0, NULL);
SetViewportOrgEx(hdc[1], 0, 0, NULL);
SelectObject(hdc[0], hBrush[fill_settings.pattern]);
SelectObject(hdc[1], hBrush[fill_settings.pattern]);
moveto(0,0);
}
示例12: save_subset
void save_subset(ImageInfo *ii)
{
if (g_poly->n > 0) {
if (crosshair_line > 0 && crosshair_samp > 0) {
// clamp crosshair to image extent, if needed
if (crosshair_line >= ii->meta->general->line_count)
crosshair_line = ii->meta->general->line_count - 1;
if (crosshair_samp >= ii->meta->general->sample_count)
crosshair_samp = ii->meta->general->sample_count - 1;
show_save_subset_window();
set_defaults(ii);
g_poly->show_extent = TRUE;
fill_big(ii);
update_save_subset_info();
} else {
asfPrintWarning("Can't save subset: No crosshair.\n");
}
} else {
// shouldn't ever get in here...
asfPrintWarning("Can't save subset: Polygon not defined.\n");
}
}
示例13: set_defaults
JNIEXPORT void JNICALL Java_us_ihmc_commonWalkingControlModules_controlModules_nativeOptimization_CVXMomentumOptimizerWithGRFSmootherNative_initialize
(JNIEnv * env, jclass jClass)
{
set_defaults();
setup_indexing();
settings.verbose = 0;
AByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.A, sizeof(double) * ASize));
bByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.b, sizeof(double) * bSize));
CByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.C, sizeof(double) * CSize));
JsByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.Js, sizeof(double) * JsSize));
psByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.ps, sizeof(double) * psSize));
WsByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.Ws, sizeof(double) * WsSize));
LambdaByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.Lambda, sizeof(double) * LambdaSize));
QrhoByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.Qrho, sizeof(double) * QrhoSize));
QphiByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.Qphi, sizeof(double) * QphiSize));
cByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.c, sizeof(double) * cSize));
rhoMinByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.rhoMin, sizeof(double) * rhoMinSize));
phiMinByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.phiMin, sizeof(double) * phiMinSize));
phiMaxByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.phiMax, sizeof(double) * phiMaxSize));
WRhoByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.WRho, sizeof(double) * WRhoSize));
WPhiByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.WPhi, sizeof(double) * WPhiSize));
rhoPreviousByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.rhoPrevious, sizeof(double) * rhoPreviousSize));
WRhoSmootherByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, params.WRhoSmoother, sizeof(double) * WRhoSmootherSize));
rhoByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, vars.rho, sizeof(double) * rhoSize));
phiByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, vars.phi, sizeof(double) * phiSize));
vdByteBuffer = (*env)->NewGlobalRef(env, (*env)->NewDirectByteBuffer(env, vars.vd, sizeof(double) * vdSize));
}
开发者ID:RIVeR-Lab,项目名称:ihmc-open-robotics-software,代码行数:30,代码来源:CVXMomentumOptimizerWithGRFSmootherNative.c
示例14: sh_utmp_reconf
int sh_utmp_reconf()
{
set_defaults();
#if defined(HAVE_PTHREAD)
sh_inotify_remove(&inotify_watch);
#endif
return 0;
}
示例15: __attribute__
__attribute__((constructor)) static void _liblogfaf_init(void) {
DBG(("liblogfaf: init()\n"));
init_progname(&shared_data);
init_hostname(&shared_data);
init_connection(&shared_data);
pthread_mutex_init(&shared_data.lock, NULL);
set_defaults(&shared_data);
}