本文整理汇总了C++中show_status函数的典型用法代码示例。如果您正苦于以下问题:C++ show_status函数的具体用法?C++ show_status怎么用?C++ show_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了show_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_status
static void
update_status(WINDOW *win, STATUS * sp)
{
switch (sp->ch) {
case ' ': /* next test-iteration */
if (has_colors()) {
if ((sp->c_msg = color_params(++(sp->c), &(sp->pair))) == 0) {
sp->c_msg = color_params(sp->c = 0, &(sp->pair));
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
} else {
if ((sp->v_msg = video_params(++(sp->v), &(sp->attr))) == 0) {
sp->v_msg = video_params(sp->v = 0, &(sp->attr));
}
}
sp->count = 0;
show_status(win, sp);
break;
case KEY_LEFT:
case 'h':
if (sp->x_val > 0)
wmove(win, sp->y_val, --(sp->x_val));
break;
case KEY_DOWN:
case 'j':
if (sp->y_val < sp->y_max)
wmove(win, ++(sp->y_val), sp->x_val);
break;
case KEY_UP:
case 'k':
if (sp->y_val > 0)
wmove(win, --(sp->y_val), sp->x_val);
break;
case KEY_RIGHT:
case 'l':
if (sp->x_val < sp->x_max)
wmove(win, sp->y_val, ++(sp->x_val));
break;
case 't':
touchline(win, sp->y_val, 1);
break;
case '=':
sp->count = 0;
show_status(win, sp);
break;
case '?':
do_subwindow(win, sp, show_help);
break;
default:
if (isdigit(sp->ch)) {
sp->count = (sp->count * 10) + (sp->ch - '0');
show_status(win, sp);
} else {
beep();
}
break;
}
}
示例2: update_status_time
/*
* Update the online time.
*/
static void update_status_time(void)
{
time_t now;
time(&now);
if (status_message_showing)
{
if (now > status_display_msg_until)
{
/* time over for status message, restore standard status line */
status_message_showing = 0;
show_status();
}
else
show_status_fmt("%$");
}
if (old_online == online || online <= (old_online + 59))
return;
if (P_LOGCONN[0] == 'Y' && old_online >= 0 && online < 0)
do_log(_("Gone offline (%ld:%02ld:%02ld)"),
old_online / 3600, (old_online / 60) % 60, old_online % 60);
old_online = online;
if (!status_message_showing)
show_status();
mc_wflush();
}
示例3: main
int main (int argc, char **argv) {
int value;
if (argc != 2) {
usage();
exit(1);
}
else if (strcmp(argv[1],"on") == 0) {
value=read_control();
if (value > 0)
value--;
show_status(write_control(value));
}
else if (strcmp(argv[1],"off") == 0) {
show_status(write_control(read_control() + 1));
}
else if (strcmp(argv[1],"status") == 0) {
verify_daemon_running();
show_status(read_control());
}
else {
usage();
exit(1);
}
exit(0);
}
示例4: update_core_config
static int update_core_config(unsigned int cpunumber, bool up)
{
int ret = -EINVAL;
unsigned int nr_cpus = num_online_cpus();
int max_cpus = tegra_cpq_max_cpus();
int min_cpus = tegra_cpq_min_cpus();
#if CPUQUIET_DEBUG_VERBOSE
pr_info(CPUQUIET_TAG "%s\n", __func__);
#endif
if (cpq_state == TEGRA_CPQ_DISABLED || cpunumber >= nr_cpu_ids)
return ret;
/* sync with tegra_cpuquiet_work_func
else if we are currently switching to LP and an up
comes we can end up with more then 1 core up and
governor stopped and !lp mode */
if (!mutex_trylock (&hotplug_lock)){
#if CPUQUIET_DEBUG_VERBOSE
pr_info(CPUQUIET_TAG "%s failed to get hotplug_lock\n", __func__);
#endif
return -EBUSY;
}
if (up) {
if(is_lp_cluster()) {
ret = -EBUSY;
} else {
if (nr_cpus < max_cpus){
show_status("UP", 0, cpunumber);
ret = cpu_up(cpunumber);
}
}
} else {
if (is_lp_cluster()) {
ret = -EBUSY;
} else {
if (nr_cpus > 1 && nr_cpus > min_cpus){
show_status("DOWN", 0, cpunumber);
ret = cpu_down(cpunumber);
}
}
}
mutex_unlock(&hotplug_lock);
return ret;
}
示例5: shjump
static void shjump(int sig)
{
char *sh;
int pid;
int status;
int f;
(void)sig;
sh = getenv("SHELL");
if (sh == NULL) {
werror(_("SHELL variable not set"));
return;
}
if ((pid = fork()) == -1) {
werror(_("Out of memory: could not fork()"));
return;
}
if (pid != 0)
mc_wleave();
if (pid == 0) {
for (f = 1; f < _NSIG; f++)
signal(f, SIG_DFL);
for (f = 3; f < 20; f++)
close(f);
fputs(_("Shelled out. Type \"exit\" to return.\n"), stdout);
execl(sh, sh, NULL);
exit(1);
}
m_wait(&status);
mc_wreturn();
if (use_status)
show_status();
}
示例6: read_all_groups
void read_all_groups(void)
{
int rc,c;
char the_path[FMSIZE],directory[15];
/* char status[50]; */
if (ncn<0) { return; }
strcpy( the_path, article_path ); /* save article_path */
for (c=0;c<maximum_group+1;c++) {
if (group[c].first_msg<=group[c].last_msg) { /* any articles? */
use_status( 2 ); /* use window info line */
newsgroup_to_directory( group[c].name, directory );
mkdir( article_path, S_IWRITE|S_IREAD );
show_status( group[c].name );
evnt_timer( 1200, 0 ); /* wait 1.2 seconds */
if (ncn>=0) {
rc = news_group( group[c].name );
read_all_articles( c, article_path );
group[c].viewed = VIEWED;
}
hide_status();
}
}
unload_group( current_newsgroup );
strcpy( article_path, the_path ); /* restore article_path */
}
示例7: read_all_articles
void read_all_articles(int g, char *the_path)
{
long c,first,last;
int x;
char status[50];
first = group[g].first_msg;
last = group[g].last_msg;
fprintf( log, "newsgroup: %s, first: %ld, last: %ld\n", group[g].name, first, last ); fflush(log);
use_status( 2 ); /* use overview window info line */
if (first<=last) {
for (c=first;c<last+1;c++) {
sprintf( current_article, "%s\\%ld.txt", the_path, c );
/* sprintf( status, "%s %ld", ErrMsg(EM_RetrieveArt), c ); */
/* sprintf( status, "%s %ld, %ld more", ErrMsg(EM_RetrieveArt), c, group[g].num_msgs ); */
sprintf( status, ErrMsg(EM_RetrieveArt), c, group[g].num_msgs );
show_status( status );
x = news_article( c, current_article );
if (x==1) { break; } /* file write error, eject */
if (x==4) { break; } /* leave if escape key used */
if (x==3) { break; } /* loss of carrier, etc. */
if (x==0) { /* update group display */
group[g].first_msg++;
group[g].num_msgs--;
}
if (memcmp(header, "4", 1)==0) { /* 412, 420, 423, 430 responses */
remove( current_article );
} else {
create_xover_header( c, current_article );
}
}
}
hide_status();
}
示例8: min_cpus_change
static void min_cpus_change(void)
{
bool g_cluster = false;
cputime64_t on_time = 0;
if (cpq_state == TEGRA_CPQ_DISABLED)
return;
mutex_lock(tegra3_cpu_lock);
if ((tegra_cpq_min_cpus() >= 2) && is_lp_cluster()) {
if (switch_clk_to_gmode()){
pr_err(CPUQUIET_TAG "min_cpus_change - switch_clk_to_gmode failed\n");
mutex_unlock(tegra3_cpu_lock);
return;
}
on_time = ktime_to_ms(ktime_get()) - lp_on_time;
show_status("LP -> off - min_cpus_change", on_time, -1);
g_cluster = true;
}
tegra_cpu_set_speed_cap(NULL);
mutex_unlock(tegra3_cpu_lock);
schedule_work(&minmax_work);
if (g_cluster && !manual_hotplug)
cpuquiet_device_free();
}
示例9: mlast_frame
mlast_frame()
{
register WORD **myframe;
register WORD *frame;
if (screen_ct >= MAX_SCREENS)
{
too_many_frames();
return;
}
if (mem_free < 32000 + 8000)
{
outta_memory();
return;
}
if ((frame = alloc(32000)) == NULL)
{
outta_memory();
return;
}
save_undo();
myframe = screens+screen_ix;
copy_pointers(myframe, myframe+1, screen_ct - screen_ix);
*myframe = frame;
copy_screen(cscreen, frame);
screen_ct++;
show_status();
}
示例10: tegra_cpuquiet_force_gmode
int tegra_cpuquiet_force_gmode(void)
{
cputime64_t on_time = 0;
if (no_lp)
return -EBUSY;
if (!is_g_cluster_present())
return -EBUSY;
if (cpq_state == TEGRA_CPQ_DISABLED)
return -EBUSY;
if (is_lp_cluster()) {
mutex_lock(tegra3_cpu_lock);
if (switch_clk_to_gmode()) {
pr_err(CPUQUIET_TAG "tegra_cpuquiet_force_gmode - switch_clk_to_gmode failed\n");
mutex_unlock(tegra3_cpu_lock);
return -EBUSY;
}
on_time = ktime_to_ms(ktime_get()) - lp_on_time;
show_status("LP -> off - force", on_time, -1);
mutex_unlock(tegra3_cpu_lock);
if (!manual_hotplug)
cpuquiet_device_free();
}
return 0;
}
示例11: main
int main(int argc, char **argv)
{
if (argc > 1)
if (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0) {
printf("\n Usage: %s [ThreadCount]\n", argv[0]);
printf("\n Default: %s 4\n", argv[0]);
exit(1);
}
if (argc > 1)
thread_count = atoi(argv[1]);
rlimit of = {1000000, 1000000};
if (-1 == setrlimit(RLIMIT_NOFILE, &of)) {
perror("setrlimit");
exit(1);
}
go server;
boost::thread_group tg;
for (int i = 0; i < thread_count; ++i)
tg.create_thread([] { g_Scheduler.RunUntilNoTask(); });
//tg.join_all();
for (;;)
{
sleep(1);
show_status();
}
return 0;
}
示例12: main
// Gets the cfg from the command line, reads it, updates the registers,
// reads the MIPS instructions from the elf file and inserts them into
// memory. Lastly, main initializes the stackpointer,
// interprets the instructions and shows the status of the registers
// after completing them.
int main(int argc, char *argv[]) {
int read;
if (argc == 3) {
read = read_config(argv[1]);
}
else {
printf(ERROR_INVALID_ARGS);
return -1;
}
if (read == 0) {
int retElfDump = elf_dump(argv[2], &PC, &mem[0], MEMSZ);
if(retElfDump != 0) {
printf(ERROR_ELF_DUMP);
return -2;
}
SP = MIPS_RESERVE + MEMSZ;
int retInterp = interp();
if (retInterp != SAW_SYSCALL && retInterp != 0) {
printf(ERROR_INTERP);
return -3;
}
show_status();
}
else {
printf(ERROR_READ_CONFIG);
return -4;
}
return 0;
}
示例13: move_next
void move_next(WINDOW *win, struct status_node *current, int direction) {
if(!current)
return;
struct status_node *next = 0;
struct status_node *boundary = 0;
if(direction > 0) {
next = current->next;
boundary = timelines[current_tl_index]->current_bottom;
}
else {
next = current->prev;
boundary = timelines[current_tl_index]->current_top;
}
if(!next) { // reached the bottom
if(direction > 0)
notify_state_change(states[STATE_REACHED_BOTTOM]);
else
notify_state_change(states[STATE_REACHED_TOP]);
return;
}
if(current != boundary) {
wmove(win,current->y_min,0);
show_status(win,current);
}
else
move_next_page(win,current,direction);
highlight_status(win,next);
timelines[current_tl_index]->current = next;
}
示例14: test_NtGdiDdGetScanLine
/*
* Test see if we can delete a DirectDrawObject from win32k
*
*/
void
test_NtGdiDdGetScanLine(HANDLE hDirectDrawLocal)
{
int fails=0;
BOOL retValue=FALSE;
DD_GETSCANLINEDATA puGetScanLineData;
printf("Start testing of NtGdiDdGetScanLine\n");
RtlZeroMemory(&puGetScanLineData,sizeof(DD_GETSCANLINEDATA));
retValue = OsThunkDdGetScanLine(NULL,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"1. NtGdiDdGetScanLine(NULL,NULL);\0");
retValue = OsThunkDdGetScanLine(hDirectDrawLocal,NULL);
testing_eq(retValue, DDHAL_DRIVER_HANDLED,fails,"2. NtGdiDdGetScanLine(hDirectDrawLocal,NULL);\0");
puGetScanLineData.ddRVal = DDERR_GENERIC;
retValue = OsThunkDdGetScanLine(hDirectDrawLocal,&puGetScanLineData);
testing_eq(retValue,DDHAL_DRIVER_NOTHANDLED,fails,"3. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
testing_noteq(puGetScanLineData.ddRVal,DD_OK,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
testing_eq(puGetScanLineData.dwScanLine,0,fails,"4. NtGdiDdGetScanLine(hDirectDrawLocal,puGetScanLineData);\0");
/* FIXME DDERR_VERTICALBLANKINPROGRESS test */
show_status(fails, "NtGdiDdGetScanLine\0");
}
示例15: received_status_stop
void
received_status_stop()
{
pthread_mutex_lock(&ui_status_cache_mutex);
ui_status_cache = STATUS_STOP;
pthread_mutex_unlock(&ui_status_cache_mutex);
show_status();
}