本文整理汇总了C++中show_progress函数的典型用法代码示例。如果您正苦于以下问题:C++ show_progress函数的具体用法?C++ show_progress怎么用?C++ show_progress使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_progress函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:SongWuCloud,项目名称:ACStor,代码行数:58,代码来源:node.c
示例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);
}
开发者ID:lyuts,项目名称:vifm,代码行数:53,代码来源:menus.c
示例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;
}
开发者ID:Vaevictusnet,项目名称:afterstep-devel,代码行数:13,代码来源:session.c
示例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);
}
开发者ID:Vaevictusnet,项目名称:afterstep-devel,代码行数:27,代码来源:module.c
示例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 )
{
}
}
}
开发者ID:Remmy,项目名称:afterstep,代码行数:29,代码来源:Ident.c
示例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" );
}
开发者ID:cooljeanius,项目名称:AfterStep,代码行数:25,代码来源:asapp.c
示例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;
}
开发者ID:afterstep,项目名称:afterstep,代码行数:35,代码来源:dbus.c
示例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
}
开发者ID:afterstep,项目名称:afterstep,代码行数:32,代码来源:dbus.c
示例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);
}
开发者ID:acklinr,项目名称:vifm,代码行数:29,代码来源:trashes_menu.c
示例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);
}
开发者ID:asilkybush,项目名称:rsync-bpc,代码行数:45,代码来源:match.c
示例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;
}
}
开发者ID:rthais,项目名称:bitcoin-wallet-recover-osx,代码行数:26,代码来源:main.cpp
示例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;
}
开发者ID:173210,项目名称:mvspsp,代码行数:35,代码来源:adhoc.c
示例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();
}
开发者ID:jiixyj,项目名称:Kartograf,代码行数:25,代码来源:MainForm.cpp
示例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);
}
开发者ID:Remmy,项目名称:afterstep,代码行数:27,代码来源:main.c
示例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;
}
开发者ID:173210,项目名称:mvspsp,代码行数:31,代码来源:adhoc.c
示例16: do_recover_pubkey_uncomp
static void do_recover_pubkey_uncomp(int keypos) {
std::vector<unsigned char> pubkey(64);
if(buffill - keypos < 64) {
fprintf(stderr, "Not enough data in buffer to recover key!\n");
return;
}
memcpy(&pubkey[0], buf+keypos, 64);
key_info* kinfo;
keymap_iter iter = pubkey_map.find(pubkey);
if(iter != pubkey_map.end()) {
kinfo = iter->second;
if(kinfo->found_pub) {
//printf("Duplicate potential public key, skipping\n");
num_dups++;
show_progress();
return;
}
} else {
kinfo = new key_info();
kinfo->pubkey = pubkey;
pubkey_map[pubkey] = kinfo;
}
kinfo->found_pub = 1;
kinfo->pubkey = pubkey;
num_pend_pub++;
//printf("Found potential pubkey: ");
//dump_hex(&pubkey[0], 64);
try_recover_key(kinfo);
}
开发者ID:rthais,项目名称:bitcoin-wallet-recover-osx,代码行数:32,代码来源:main.cpp
示例17: copy_table_entry_write
/*
* Copy one copy table entry form /proc/vmcore to dump partition
*/
static int copy_table_entry_write(int fdin, int fdout,
struct copy_table_entry *entry,
unsigned long offset)
{
unsigned long buf_size, bytes_left, off;
void *map;
if (entry->size == 0)
return 0;
off = entry->off;
bytes_left = entry->size;
if (lseek(fdout, entry->off + offset, SEEK_SET) < 0)
return -1;
while (bytes_left > 0) {
buf_size = MIN(COPY_BUF_SIZE, bytes_left);
map = mmap(0, buf_size, PROT_READ, MAP_SHARED, fdin, off);
if (map == (void *)-1) {
PRINT_PERR("Mapping failed\n");
return -1;
}
if (write(fdout, map, buf_size) < 0) {
PRINT_PERR("Write to partition failed\n");
return -1;
}
munmap(map, buf_size);
bytes_left -= buf_size;
off += buf_size;
show_progress(buf_size);
}
return 0;
}
开发者ID:hreinecke,项目名称:s390-tools,代码行数:34,代码来源:zfcpdump_part.c
示例18: 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!
*
* @param i If >0, the number of a matched token. If 0, indicates we
* have only literal data.
**/
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 (verbose > 2 && i >= 0) {
rprintf(FINFO,
"match at %.0f last_match=%.0f j=%d len=%ld n=%ld\n",
(double)offset, (double)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 && do_progress)
show_progress(last_match, buf->file_size);
}
开发者ID:locked,项目名称:rsync-pgsql,代码行数:46,代码来源:match.c
示例19: MakeASFile
static int
MakeASFile (const char *name)
{
FILE *touch;
show_progress ("Creating %s ... ", name);
if ((touch = fopen (name, "w")) == NULL)
{
show_error ("Cannot open file %s for writing!\n"
" Please check permissions or contact your sysadmin !", name);
return (-1);
}
fclose (touch);
show_progress("\t created.");
return 0;
}
开发者ID:Vaevictusnet,项目名称:afterstep-devel,代码行数:16,代码来源:session.c
示例20: show_progress
/* Reads the contents of file descriptor FD, until it is closed, or a
read error occurs. The data is read in 8K chunks, and stored to
stream fp, which should have been open for writing. If BUF is
non-NULL and its file descriptor is equal to FD, flush RBUF first.
This function will *not* use the rbuf_* functions!
The EXPECTED argument is passed to show_progress() unchanged, but
otherwise ignored.
If opt.verbose is set, the progress is also shown. RESTVAL
represents a value from which to start downloading (which will be
shown accordingly). If RESTVAL is non-zero, the stream should have
been open for appending.
The function exits and returns codes of 0, -1 and -2 if the
connection was closed, there was a read error, or if it could not
write to the output stream, respectively.
IMPORTANT: The function flushes the contents of the buffer in
rbuf_flush() before actually reading from fd. If you wish to read
from fd immediately, flush or discard the buffer. */
int
get_contents (int fd, FILE *fp, long *len, long restval, long expected,
struct rbuf *rbuf)
{
int res;
static char c[8192];
*len = restval;
if (opt.verbose)
show_progress (restval, expected, SP_INIT);
if (rbuf && RBUF_FD (rbuf) == fd)
{
while ((res = rbuf_flush (rbuf, c, sizeof (c))) != 0)
{
if (fwrite (c, sizeof (char), res, fp) < res)
return -2;
if (opt.verbose)
{
if (show_progress (res, expected, SP_NONE))
fflush (fp);
}
*len += res;
}
}
/* Read from fd while there is available data. */
do
{
res = iread (fd, c, sizeof (c));
if (res > 0)
{
if (fwrite (c, sizeof (char), res, fp) < res)
return -2;
if (opt.verbose)
{
if (show_progress (res, expected, SP_NONE))
fflush (fp);
}
*len += res;
}
} while (res > 0);
if (res < -1)
res = -1;
if (opt.verbose)
show_progress (0, expected, SP_FINISH);
return res;
}
开发者ID:aosm,项目名称:wget,代码行数:67,代码来源:retr.c
注:本文中的show_progress函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论