本文整理汇总了C++中show_progress函数的典型用法代码示例。如果您正苦于以下问题:C++ show_progress函数的具体用法?C++ show_progress怎么用?C++ show_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_progress函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: node_recovery_progress
static int node_recovery_progress(void)
{
int result;
unsigned int prev_nr_total;
struct recovery_state rstate;
/*
* ToDos
*
* 1. Calculate size of actually copied objects.
* For doing this, not so trivial changes for recovery process are
* required.
*
* 2. Print remaining physical time.
* Even if it is not so acculate, the information is helpful for
* administrators.
*/
result = get_recovery_state(&rstate);
if (result < 0)
return EXIT_SYSFAIL;
if (!rstate.in_recovery)
return EXIT_SUCCESS;
do {
prev_nr_total = rstate.nr_total;
result = get_recovery_state(&rstate);
if (result < 0)
break;
if (!rstate.in_recovery) {
show_progress(prev_nr_total, prev_nr_total, true);
break;
}
switch (rstate.state) {
case RW_PREPARE_LIST:
printf("\rpreparing a checked object list...");
break;
case RW_NOTIFY_COMPLETION:
printf("\rnotifying a completion of recovery...");
break;
case RW_RECOVER_OBJ:
show_progress(rstate.nr_finished, rstate.nr_total,
true);
break;
default:
panic("unknown state of recovery: %d", rstate.state);
break;
}
sleep(1);
} while (true);
return result < 0 ? EXIT_SYSFAIL : EXIT_SUCCESS;
}
示例2: capture_output_to_menu
int
capture_output_to_menu(FileView *view, const char cmd[], menu_info *m)
{
FILE *file, *err;
char *line = NULL;
int x;
pid_t pid;
LOG_INFO_MSG("Capturing output of the command to a menu: %s", cmd);
pid = background_and_capture((char *)cmd, &file, &err);
if(pid == (pid_t)-1)
{
show_error_msgf("Trouble running command", "Unable to run: %s", cmd);
return 0;
}
show_progress("", 0);
ui_cancellation_reset();
ui_cancellation_enable();
wait_for_data_from(pid, file, 0);
x = 0;
while((line = read_line(file, line)) != NULL)
{
char *expanded_line;
show_progress("Loading menu", 1000);
m->items = realloc(m->items, sizeof(char *)*(x + 1));
expanded_line = expand_tabulation_a(line, cfg.tab_stop);
if(expanded_line != NULL)
{
m->items[x++] = expanded_line;
}
wait_for_data_from(pid, file, 0);
}
m->len = x;
ui_cancellation_disable();
fclose(file);
print_errors(err);
if(ui_cancellation_requested())
{
append_to_string(&m->title, "(cancelled) ");
append_to_string(&m->empty_msg, " (cancelled)");
}
return display_menu(m, view);
}
示例3: MakeASDir
static int
MakeASDir (const char *name, mode_t perms)
{
show_progress ("Creating %s ... ", name);
if (mkdir (name, perms))
{
show_error ("AfterStep depends on %s directory !\nPlease check permissions or contact your sysadmin !",
name);
return (-1);
}
show_progress ("\t created.");
return 0;
}
示例4: LoadBaseConfig
void
LoadBaseConfig(void (*read_base_options_func) (const char *))
{
if( read_base_options_func == NULL )
return ;
if( Session == NULL )
{
show_error("Session has not been properly initialized. Exiting");
exit(1);
}
if (Session->overriding_file == NULL )
{
char *configfile = make_session_file(Session, BASE_FILE, False/* no longer use #bpp in filenames */ );
if( configfile != NULL )
{
read_base_options_func (configfile);
show_progress("BASE configuration loaded from \"%s\" ...", configfile);
free( configfile );
}else
{
show_warning("BASE configuration file cannot be found");
}
}else
read_base_options_func (Session->overriding_file);
}
示例5: process_message
void
process_message (send_data_type type, send_data_type *body)
{
LOCAL_DEBUG_OUT( "received message %lX", type );
if( type == M_END_WINDOWLIST )
{
fill_window_data();
display_window_data();
}else if( (type&WINDOW_PACKET_MASK) != 0 )
{
struct ASWindowData *wd = fetch_window_by_id( body[0] );
WindowPacketResult res ;
show_progress( "message %X window %X data %p", type, body[0], wd );
res = handle_window_packet( type, body, &wd );
if( res == WP_DataCreated )
{
/* we may need to translate frame window into client window,
* as Window Data is hashed by client, and get_target_window
* return the frame */
if( wd->frame == MyArgs.src_window )
MyArgs.src_window = wd->client ;
}else if( res == WP_DataChanged )
{
}else if( res == WP_DataDeleted )
{
}
}
}
示例6: set_environment_tool_from_list
void
set_environment_tool_from_list( ASEnvironment *e, ASToolType type, char ** list, int list_len )
{
int i ;
destroy_string( &(e->tool_command[type]) );
for( i = 0 ; i < list_len ; ++i )
if( list[i] )
{
char *tmp = list[i] ;
char *fullname = NULL ;
if( tmp[0] == '$' )
tmp = copy_replace_envvar( tmp );
if( get_executable_in_path( tmp, &fullname ) )
{
e->tool_command[type] = fullname;
break;
}else
show_warning( "%s command %s is not in the path", _as_tools_name[type], tmp );
if (tmp != list[i])
free(tmp);
}
if( e->tool_command[type] == NULL )
e->tool_command[type] = as_get_default_tool(type);
show_progress( "%s is set to: \"%s\"", _as_tools_name[type], e->tool_command[type]?e->tool_command[type]:"none" );
}
示例7: asdbus_LogoutKDE
static Bool asdbus_LogoutKDE (KDE_ShutdownConfirm confirm, KDE_ShutdownMode mode, KDE_ShutdownType type, int timeout)
{
Bool requested = False;
#ifdef HAVE_DBUS_CONTEXT
if (ASDBus.session_conn) {
DBusMessage *message =
dbus_message_new_method_call (KSMSERVER_NAME,
KSMSERVER_PATH,
KSMSERVER_INTERFACE,
"logout");
if (message) {
DBusMessageIter iter;
dbus_uint32_t msg_serial;
dbus_int32_t i32_confirm = confirm;
dbus_int32_t i32_mode = mode;
dbus_int32_t i32_type = type;
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i32_confirm);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i32_mode);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i32_type);
dbus_message_set_no_reply (message, TRUE);
if (!dbus_connection_send (ASDBus.session_conn, message, &msg_serial))
show_error ("Failed to send Logout request to KDE.");
else {
requested = True;
show_progress ("Sent Ok to end session (time, %ld).", time (NULL));
}
dbus_message_unref (message);
}
}
#endif
return requested;
}
示例8: asdbus_EndSessionOk
void asdbus_EndSessionOk ()
{
show_debug(__FILE__, __FUNCTION__, __LINE__, "dbus EndSessionOk");
#ifdef HAVE_DBUS_CONTEXT
if (ASDBus.session_conn) {
DBusMessage *message =
dbus_message_new_method_call (SESSIONMANAGER_NAME,
ASDBus.gnomeSessionPath, /*"/org/gnome/SessionManager", */
IFACE_SESSION_PRIVATE,
"EndSessionResponse");
show_debug(__FILE__, __FUNCTION__, __LINE__, "dbus EndSessionResponse to iface = \"%s\", path = \"%s\", manager = \"%s\"",
IFACE_SESSION_PRIVATE, ASDBus.gnomeSessionPath, SESSIONMANAGER_NAME);
if (message) {
DBusMessageIter iter;
char *reason = "";
dbus_bool_t ok = 1;
dbus_uint32_t msg_serial;
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &ok);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_STRING, &reason);
dbus_message_set_no_reply (message, TRUE);
if (!dbus_connection_send
(ASDBus.session_conn, message, &msg_serial))
show_error ("Failed to send EndSession indicator.");
else
show_progress ("Sent Ok to end session (time, %ld).", time (NULL));
dbus_message_unref (message);
}
}
#endif
}
示例9: show_trashes_menu
int
show_trashes_menu(view_t *view, int calc_size)
{
char **trashes;
int ntrashes;
int i;
static menu_data_t m;
menus_init_data(&m, view,
format_str("%sNon-empty trash directories", calc_size ? "[ size] " : ""),
strdup("No non-empty trash directories found"));
m.execute_handler = &execute_trashes_cb;
m.key_handler = &trashes_khandler;
m.extra_data = calc_size;
trashes = list_trashes(&ntrashes);
show_progress(NULL, 0);
for(i = 0; i < ntrashes; i++)
{
char *const item = format_item(trashes[i], calc_size);
m.len = put_into_string_array(&m.items, m.len, item);
}
free_string_array(trashes, ntrashes);
return menus_enter(m.state, view);
}
示例10: matched
/* Transmit a literal and/or match token.
*
* This delightfully-named function is called either when we find a
* match and need to transmit all the unmatched data leading up to it,
* or when we get bored of accumulating literal data and just need to
* transmit it. As a result of this second case, it is called even if
* we have not matched at all!
*
* If i >= 0, the number of a matched token. If < 0, indicates we have
* only literal data. A -1 will send a 0-token-int too, and a -2 sends
* only literal data, w/o any token-int. */
static void matched(int f, struct sum_struct *s, struct map_struct *buf,
OFF_T offset, int32 i)
{
int32 n = (int32)(offset - last_match); /* max value: block_size (int32) */
int32 j;
if (DEBUG_GTE(DELTASUM, 2) && i >= 0) {
rprintf(FINFO,
"match at %s last_match=%s j=%d len=%ld n=%ld\n",
big_num(offset), big_num(last_match), i,
(long)s->sums[i].len, (long)n);
}
send_token(f, i, buf, last_match, n, i < 0 ? 0 : s->sums[i].len);
data_transfer += n;
if (i >= 0) {
stats.matched_data += s->sums[i].len;
n += s->sums[i].len;
}
for (j = 0; j < n; j += CHUNK_SIZE) {
int32 n1 = MIN(CHUNK_SIZE, n - j);
sum_update(map_ptr(buf, last_match + j, n1), n1);
}
if (i >= 0)
last_match = offset + s->sums[i].len;
else
last_match = offset;
if (buf && INFO_GTE(PROGRESS, 1))
show_progress(last_match, buf->file_size);
}
示例11: refill_buf
static int refill_buf(void) {
int ret;
//printf("refill_buf: fill = %i pos = %i\n", buffill, bufpos);
if(bufpos > BUF_WATERMARK) {
memcpy(buf, buf + BUF_SEGMENT, BUF_LEN-BUF_SEGMENT);
buffill -= BUF_SEGMENT;
bufpos -= BUF_SEGMENT;
}
if(buffill < BUF_LEN) {
ret = read(f, buf+buffill, BUF_LEN-buffill);
if(ret < 0) {
perror("Device read");
exit(1);
}
//printf("Read %i bytes\n", ret);
buffill += ret;
fpos += ret;
if(fpos > fnextcp) {
show_progress();
fnextcp = fpos + (ftotallen/1024);
}
return ret;
} else {
return -1;
}
}
示例12: adhocDisconnect
static void adhocDisconnect(void)
{
char message[256];
sprintf(message, TEXT(DISCONNECTING_FROM_x), TEXT(LOBBY));
adhoc_init_progress(8, message);
sceNetAdhocMatchingStop(matchingId);
update_progress();
sceNetAdhocMatchingDelete(matchingId);
update_progress();
sceNetAdhocMatchingTerm();
update_progress();
sceNetAdhocctlDisconnect();
update_progress();
sceNetAdhocPdpDelete(pdpId, 0);
update_progress();
sceNetAdhocctlTerm();
update_progress();
sceNetAdhocTerm();
update_progress();
sceNetTerm();
update_progress();
show_progress(TEXT(DISCONNECTED));
adhoc_initialized = 0;
}
示例13: calculateMinMaxPoint
void MainForm::populateScene() {
stop = false;
std::pair<int, int> min_norm, max_norm;
calculateMinMaxPoint(min_norm, max_norm, *bf_);
size_t range = static_cast<size_t>(max_norm.second - min_norm.second + 1);
boost::progress_display show_progress(range);
std::list<std::vector<int> > tiles(range);
size_t tiles_nr = fillTiles(tiles, *bf_, min_norm, max_norm, show_progress);
tbb::atomic<size_t> progress_index, mem_index;
progress_index = 0;
mem_index = 0;
show_progress.restart(tiles_nr);
std::list<std::vector<int> >::iterator it = tiles.begin();
tbb::task_scheduler_init init;
for (int i = min_norm.second; i <= max_norm.second; ++i) {
tbb::parallel_for(tbb::blocked_range<std::vector<int>::iterator>
(it->begin(), it->end()),
ApplyFooQT(this, i, &progress_index));
if (stop) break;
++it;
show_progress += progress_index;
progress_index = 0;
}
bf_->clear_cache();
}
示例14: redecorateVolumes
void redecorateVolumes() {
ASVolumeCanvasPlacement placement;
int width, height;
placement.vertical = get_flags(Config->flags, ASMOUNT_Vertical);
placement.tileWidth = DEFAULT_TILE_WIDTH;
placement.tileHeight = DEFAULT_TILE_HEIGHT;
placement.currPos = 0;
iterate_asbidirlist (AppState.volumes, redecorateVolume, &placement, NULL, False);
XMapSubwindows (dpy, AppState.mainCanvas->w);
width = placement.tileWidth;
height = placement.tileHeight;
if (placement.vertical)
height = placement.currPos;
else
width = placement.currPos;
setHints (width, height);
/* setHints must happen first */
show_progress ( "resizing main canvas to %dx%d", width, height);
resize_canvas (AppState.mainCanvas, width, height);
ASSync (False);
}
示例15: adhocTerm
int adhocTerm(void)
{
if (adhoc_initialized > 0)
{
char message[256];
sprintf(message, TEXT(DISCONNECTING_FROM_x), Server ? TEXT(CLIENT) : TEXT(SERVER));
adhoc_init_progress(5, message);
sceNetAdhocctlDisconnect();
update_progress();
sceNetAdhocPdpDelete(pdpId, 0);
update_progress();
sceNetAdhocctlTerm();
update_progress();
sceNetAdhocTerm();
update_progress();
sceNetTerm();
update_progress();
show_progress(TEXT(DISCONNECTED));
adhoc_initialized = 0;
}
return 0;
}