static int _help (struct helpdata *helpdata, char *argname) { struct helpdata *p; printf ("%s\n", _("Options are:")); if (argname == NULL || argname[0] == '?') { /* Short version */ for (p = helpdata; p->name; p++) { printf (" "); print_short (p->name); putchar ('\n'); } } else { for (p = helpdata; p->name; p++) { int n; n = printf (" "); n += print_short (p->name); print_descr (n+1, _(p->descr)); } } return 0; }
void MethodScope::print() { print_short(); InlinedScope::print(); if (sender()) { lprintf(" sender: "); sender()->print_short(); } lprintf(" @ %ld\n", senderBCI()); method()->pretty_print(); }
int lg2_status(git_repository *repo, int argc, char *argv[]) { git_status_list *status; struct opts o = { GIT_STATUS_OPTIONS_INIT, "." }; o.statusopt.show = GIT_STATUS_SHOW_INDEX_AND_WORKDIR; o.statusopt.flags = GIT_STATUS_OPT_INCLUDE_UNTRACKED | GIT_STATUS_OPT_RENAMES_HEAD_TO_INDEX | GIT_STATUS_OPT_SORT_CASE_SENSITIVELY; parse_opts(&o, argc, argv); if (git_repository_is_bare(repo)) fatal("Cannot report status on bare repository", git_repository_path(repo)); show_status: if (o.repeat) printf("\033[H\033[2J"); /** * Run status on the repository * * We use `git_status_list_new()` to generate a list of status * information which lets us iterate over it at our * convenience and extract the data we want to show out of * each entry. * * You can use `git_status_foreach()` or * `git_status_foreach_ext()` if you'd prefer to execute a * callback for each entry. The latter gives you more control * about what results are presented. */ check_lg2(git_status_list_new(&status, repo, &o.statusopt), "Could not get status", NULL); if (o.showbranch) show_branch(repo, o.format); if (o.showsubmod) { int submod_count = 0; check_lg2(git_submodule_foreach(repo, print_submod, &submod_count), "Cannot iterate submodules", o.repodir); } if (o.format == FORMAT_LONG) print_long(status); else print_short(repo, status); git_status_list_free(status); if (o.repeat) { sleep(o.repeat); goto show_status; } return 0; }
void BlockScope::print() { print_short(); InlinedScope::print(); if (parent()) { printf("\tparent: "); parent()->print_short(); } if (sender()) { lprintf(" sender: "); sender()->print_short(); } lprintf(" @ %ld\n", senderBCI()); method()->pretty_print(); }
/* func: get a valid device */ unsigned short getOneValidDevice(void) { unsigned long lbus; unsigned long lslot; unsigned long lfunc = 0; unsigned short device; unsigned short vendor; unsigned long address; unsigned short class_sub; unsigned short progif_rev; unsigned short pin_line; unsigned long base_address; unsigned short cmd; unsigned short status; print_string(" VENDOR DEVICE CMD STATUS CLASS|SUB PROGIF|REV PIN|LINE BASE_ADDR"); print_return(); for (lbus =0; lbus < 256; lbus++) { for (lslot = 0; lslot < 32; lslot++) { for (lfunc = 0; lfunc < 8; lfunc++) { PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x00, address, vendor); /*vendor = pciConfigReadWord(bus, slot, 0, 0);*/ if(vendor != 0xFFFF) { /* device = pciConfigReadWord(bus, slot, 0, 2); */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x02, address, device); /* Class code|subclass */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x0a, address, class_sub); /* Command */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x04, address, cmd); /* Status */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x06, address, status); /* Prog IF| Revision ID */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x08, address, progif_rev); /* Interrupt PIN | Interrupt Line */ PCI_CONFIG_READ_WORD(lbus, lslot, lfunc, 0x3c, address, pin_line); /* base address #0 */ PCI_CONFIG_READ_DWORD(lbus, lslot, lfunc, 0x10, address, base_address); // netcard: intel e1000 if ((vendor == 0x8086) && (device == 0x100F)) { print_short(vendor); print_short(device); print_short(cmd); print_short(status); print_short(class_sub); print_short(progif_rev); print_short(pin_line); print_long(base_address & 0xFFFFFFFC); print_return(); } } } } } // print_string(" Today is 20130526, I'm coding for NetCard."); return 0; }
ldouble Synaps::impuls(ldouble in){ // signals.push_back(in); #ifdef LOG print_short(); std::cout<<"Synaps::impuls in: "<<in<<" out : "<<w.back() * in<<"\n"; #endif #ifdef LOW_MEM return w * in; #else return w.back() * in;//signals.back(); #endif }; // Synaps::impuls
template<> void BlockLocationList::print() { print_short(); lprintf(": length %ld (max %ld) { ", (void*)long(len), (void*)long(max)); for (fint i = 0; i < length(); i++) { BlockLocation bl = nth(i); if (bl.memoized) { lprintf("[%#lx] ", bl.loc); } else { lprintf("%#lx ", bl.loc); } } lprintf("}\n"); }
//----------------------------------------------------------------------------- int main(int argc, char **argv) { struct stat finfo; char fname[PATH_MAX+1]; int n, i, opts, single_file_mode = 0; struct dirent **list; config c; opts = options(argc, argv, &c); if(opts != OPT_OK) return -1; // if scandir raises error, switch to single file mode as argument is probably not a directory if((n = scandir(c.dir, &list, NULL, alphasort)) < 0) { perror("main()/scandir(): falling back to single file mode"); single_file_mode = 1; n = 1; } for(i=0; i < n; i++) { // prepend file name with directory (needed for dirs other than .) if(!single_file_mode) snprintf(fname, sizeof fname, "%s/%s", c.dir, list[i]->d_name); // get file info if(lstat(single_file_mode ? c.dir : fname, &finfo) == -1) { perror("main()/stat()"); continue; } if(!filter_perm(&finfo, &c)) continue; // print entry with configured view switch(c.view) { case VIEW_SHORT: print_short(&finfo, single_file_mode ? c.dir : fname, single_file_mode ? c.dir : list[i]->d_name); break; case VIEW_LONG: print_long(&finfo, single_file_mode ? c.dir : fname, single_file_mode ? c.dir : list[i]->d_name); break; case VIEW_MINI: print_minimal(&finfo, single_file_mode ? c.dir : fname, single_file_mode ? c.dir : list[i]->d_name); break; default: fprintf(stderr, "main()/c.view: Oops! Something went wrong!\n"); } } return 0; }
void BitVector::print() { print_short(); lprintf(": {"); fint i, last = -1; for (i = 0; i < length; i++) { if (includes(i)) { if (last < 0) { lprintf(" %ld", (void*)i); // first bit after string of 0s last = i; } } else { if (last >= 0) lprintf("..%ld", (void*)(i - 1)); // ended a group last = -1; } } if (last >= 0) lprintf("..%ld", (void*)(i - 1)); lprintf(" }"); }
void objectLookupTarget::print() { printIndent(); print_short(); lprintf(" 0x%lx: ", this); obj->print_real_oop(); lprintf(" (map: 0x%lx)\n", map()); Indent ++; if (prevTargetSlot) { printIndent(); lprintf("prevTarget:\n"); Indent ++; prevTargetSlot->print(); Indent --; } if (links) { links->print(); } printIndent(); lprintf("valueConstrained: %s\n", value_constrained ? "yes" : "no"); Indent --; }
void SICompiler::print() { print_short(); lprintf(":"); L->print(); if (L->result()) { L->result()->print(); if (method()) { lprintf("\tmethod: "); method()->print_real_oop(); lprintf("\n"); } } else { lprintf("\tmethod: "); method()->print_real_oop(); lprintf("; methodHolder: "); methodHolder_or_map()->print_real_oop(); lprintf("\n"); } lprintf("\treceiver: "); L->receiver->print_real_oop(); lprintf("\tnodeGen: %#lx\n", nodeGen); lprintf("\tp ((SICompiler*)%#lx)->print_code()\n", this); }
void SList::print() { print_short(); lprintf(": "); applyL(print_them); }
int Short_practice(void) { char sentence[30][N] = {"Courage is resistance to fear, mastery of fear - not absence of fear", //배열 초기화. "Poetry is the mother tongue of mankind", "Misery loves company", "Man is but a reed, the weaken in nature, but he is a thinking reed", "Who reflects too much will accomplish little", "Man should keep his friendship in constant repair", "The right people in the right jobs", "Time is the rider that breaks youth", "A deep distress hath humanized my soul", "Who reflects too much will accomplish little", "Nature does not proceed by leaps", "Man is a voluntary agent", "Men have no right to what is not reasonable", "Wealth brings with it many anxieties", "Being in a ship is being in a jail, with the chance of being drowned", "Life is a progress from want to want, not from enjoyment to enjoyment", "Life is half spent before we know what it is", "The first virtue of a painting is to be a feast for the eyes", "Love truth, but pardon error", "It is a wise father that knows his own child", "A man apt to promise is apt to forget", "We are not hypocrites in our sleep", "Genius does what it must, and talent does what it can", "The right people in the right jobs", "Experience is the only prophecy of wise men", "You never miss the water till the well runs dry", "A little learning is a dangerous thing", "No one can be more wise than destiny", "Old men are always young enough to learn, with profit", "Music has charms to soothe a savage breast"}; char Check[N]=""; char print[N]=""; char back[1]={0}; int command[2]={27,127}; //esc, backspace의 아스키 코드값 입력. int escape,i=0, n=0, good=0, bad=0, process=0, count, choose, right=0, right_sentence=0; double current=0.0, best=0.0, correct=0.0, timer; time_t start, end; //time함수 이용. srand(time(NULL)); for(count=0; count<5; good=0, bad=0, n=0) { //5개 반복. choose = rand()%30; //무작위로 30개중 하나 선택. strcpy(print,sentence[choose]); //sentence배열에서 하나 고른것을 print배열로 복사(2차원 배열에 있던것을 1차원 배열에 입력시켜서 비교) right=strlen(sentence[choose]); //고른 문장의 문자갯수를 right에 입력시킴. char Check[N]=""; start = time(NULL); for(i=0; i<N; i++) { //최대 N개라고 가정하고 입력받는 for문을 실행. system("clear"); print_short(process, current, best, correct); //출력 printf("%s\n", print); printf("%s", Check); //getch함수 사용시 문자를 나타내기 위해 입력받은 Check배열을 출력시킨다. Check[i]=getch(); if(Check[i]!=command[1]) { if(Check[i]==print[i]) good++; if(Check[i]!=print[i]) bad++; } else { //만약 입력받은 것이 backspace면 앞에 있는 문자가 맞다면 good--를, 틀리다면 bad--를 실행 if (Check[i-1]==print[i-1]) good--; if (Check[i-1]!=print[i-1]) bad--; Check[i-1]=Check[i]=back[0]; //출력을 위해 i-1번째, i번째에 널문자를 입력함. i=i-2; //i-1번째로 가기위해서는 for문돌때 i++이 되므로 i-2를 i에 입력시킨다. }; end = time(NULL); if (Check[i]==command[0]) { //esc를 입력했을 경우 종료시킨다. printf("\n짧은 글 연습을 종료합니다.\n"); sleep(1); return 0; }; if (Check[i]=='\n') break; //개행문자 입력시 break이용, for문 빠져나옴. timer =end - start; //마침시간-시작시간을 이용 current = (double)(good/timer)*60; //입력받는 시간을 이용, 현재타수를 구함. correct = (double)good/(good+bad)*100; if(best<current) best=current; //현재타수중에 가장 높은 타수를 best문자에 입력시킴. }; if (right==good) //right과 good이 같으면 문장을 맞게 입력했으므로 right_sentence++. right_sentence++; count++; process +=20; }; printf("\n\n결과 :: 진행도 : %d%c 맞은 문장수 : %d 틀린 문장수 : %d 최고타수 : %.0lf \n",process,37,right_sentence, 5-right_sentence, best); sleep(1); printf("\n짧은 글 연습을 종료합니다.\n"); sleep(1); while(1) { printf("::enter키를 입력하세요::"); escape=getchar(); if(escape=='\n') {system("clear"); return 3; }; }; return 3; }
void Compiler::print() { print_short(); lprintf(":"); key->print(); lprintf("\tmethod: %s\n", method->print_string()); lprintf("\tp ((Compiler*)%#lx)->print_code()\n", this); }
static void print_file(int parent, FTSENT *child) { OBJ obj; FTSENT *list; struct stat *st; struct passwd *pwd; struct group *grp; int64_t size_total; int64_t temp_num; int temp_count; /* count length */ /* max length for each field when output */ int block_max; int group_max; int ino_max; int link_max; int major_max; int minor_max; int size_max; int user_max; obj.obj_isroot = 0; size_total = 0; block_max = group_max = ino_max = link_max = major_max = minor_max = size_max = user_max = 1; /* * Preprocess the files' information before output. The fts_number * field is used as the flag to determine whether to output the file * or not. * * fts_number is used for determining if the file should be output * or not. */ for (list = child; list != NULL; list = list->fts_link) { if (list->fts_info == FTS_ERR || list->fts_info == FTS_NS) { warnx("%s: file error: %s", list->fts_name, strerror(list->fts_errno)); return_val = EXIT_FAILURE; list->fts_number = FTS_NO_PRINT; continue; } else if (list->fts_info == FTS_DC || list->fts_info == FTS_DNR) { warnx("%s: directory error: %s", list->fts_name, strerror(list->fts_errno)); return_val = EXIT_FAILURE; list->fts_number = FTS_NO_PRINT; continue; } else if (list->fts_info == FTS_DP) { list->fts_number = FTS_NO_PRINT; continue; } if (parent == ROOT) { obj.obj_isroot = 1; if (!f_dir && list->fts_info == FTS_D) { list->fts_number = FTS_NO_PRINT; continue; } } else { obj.obj_isroot = 0; if (!f_listall && list->fts_name[0] == '.') { list->fts_number = FTS_NO_PRINT; continue; } } if ((st = list->fts_statp) == NULL) { warn("%s: cannot stat", list->fts_name); list->fts_number = FTS_NO_PRINT; return_val = EXIT_FAILURE; continue; } size_total += st->st_blocks * DEFAULT_BSIZE; /* count max width of block and size */ if (f_readable) { block_max = size_max = 5; /* i.e. 1023K */ } else if (f_kb) { COUNT_LENTH(st->st_blocks * DEFAULT_BSIZE / 1024); block_max = MAX(block_max, temp_count); COUNT_LENTH(st->st_size / 1024); size_max = MAX(size_max, temp_count); } else { COUNT_LENTH(st->st_blocks * DEFAULT_BSIZE / blksize); block_max = MAX(block_max, temp_count); COUNT_LENTH(st->st_size); size_max = MAX(size_max, temp_count); } /* count max width of ino */ COUNT_LENTH(st->st_ino); ino_max = MAX(ino_max, temp_count); /* count max width of links */ COUNT_LENTH(st->st_nlink); link_max = MAX(link_max, temp_count); /* count max width of major and minor device */ if (S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) { COUNT_LENTH(major(st->st_rdev)); major_max = MAX(major_max, temp_count); COUNT_LENTH(minor(st->st_rdev)); minor_max = MAX(minor_max, temp_count); } /* count max width of user and group */ if (f_numid) { COUNT_LENTH(st->st_uid); user_max = MAX(user_max, temp_count); COUNT_LENTH(st->st_gid); group_max = MAX(group_max, temp_count); } else { if ((pwd = getpwuid(st->st_uid)) == NULL) { if (errno != 0) return_val = EXIT_FAILURE; COUNT_LENTH(st->st_uid); } else temp_count = strlen(pwd->pw_name); user_max = MAX(user_max, temp_count); if ((grp = getgrgid(st->st_gid)) == NULL) { if (errno != 0) return_val = EXIT_FAILURE; COUNT_LENTH(st->st_gid); } else temp_count = strlen(grp->gr_name); group_max = MAX(group_max, temp_count); } } /* keep the size width the same */ if (size_max < major_max + minor_max + 2) size_max = major_max + minor_max + 2; else major_max = size_max - 2 - minor_max; obj.obj_list = child; obj.obj_size_total = size_total; obj.obj_block_max = block_max; obj.obj_group_max = group_max; obj.obj_ino_max = ino_max; obj.obj_link_max = link_max; obj.obj_major_max = major_max; obj.obj_minor_max = minor_max; obj.obj_size_max = size_max; obj.obj_user_max = user_max; if(f_long) print_long(&obj); else print_short(&obj); }
void ResourceAreaChunk::print() { if (prev) prev->print(); print_short(); lprintf(": [%#lx, %#lx), prev = %#lx\n", bottom, top, prev); }
void VMObj::print() { print_short();}
void main(){ short i; unsigned long u, v; // iota constant RC[0]=1; RC[1]=0; RC[2]=32898; RC[3]=0; RC[4]=32906; RC[5]=2147483648; RC[6]=2147516416; RC[7]=2147483648; RC[8]=32907; RC[9]=0; RC[10]=2147483649; RC[11]=0; RC[12]=2147516545; RC[13]=2147483648; RC[14]=32777; RC[15]=2147483648; RC[16]=138; RC[17]=0; RC[18]=136; RC[19]=0; RC[20]=2147516425; RC[21]=0; RC[22]=2147483658; RC[23]=0; RC[24]=2147516555; RC[25]=0; RC[26]=139; RC[27]=2147483648; RC[28]=32905; RC[29]=2147483648; RC[30]=32771; RC[31]=2147483648; RC[32]=32770; RC[33]=2147483648; RC[34]=128; RC[35]=2147483648; RC[36]=32778; RC[37]=0; RC[38]=2147483658; RC[39]=2147483648; RC[40]=2147516545; RC[41]=2147483648; RC[42]=32896; RC[43]=2147483648; RC[44]=2147483649; RC[45]=0; RC[46]=2147516424; RC[47]=2147483648; // rho pi constants r[0]=0; r[1]=1; r[2]=62; r[3]=28; r[4]=27; r[5]=36; r[6]=44; r[7]=6; r[8]=55; r[9]=20; r[10]=3; r[11]=10; r[12]=43; r[13]=25; r[14]=39; r[15]=41; r[16]=45; r[17]=15; r[18]=21; r[19]=8; r[20]=18; r[21]=2; r[22]=61; r[23]=56; r[24]=14; pB[0]=0; pB[1]=10; pB[2]=20; pB[3]=5; pB[4]=15; pB[5]=16; pB[6]=1; pB[7]=11; pB[8]=21; pB[9]=6; pB[10]=7; pB[11]=17; pB[12]=2; pB[13]=12; pB[14]=22; pB[15]=23; pB[16]=8; pB[17]=18; pB[18]=3; pB[19]=13; pB[20]=14; pB[21]=24; pB[22]=9; pB[23]=19; pB[24]=4; // Set up and display state for( i=0; i<K_LANES; i++ ) { A[2*i] = 0; A[2*i+1] = 0; } A[0]=123456L; A[2]=234567L; A[4]=345678L; A[6]=456789L; A[8]=567890L; #ifdef __TRS80__ /* Display resulting state */ for( i=0; i<K_LANES; i++ ){ if( 0==i || 5==i || 10==i || 15==i || 20==i ) print_crlf(); u = A[2*i]; v = A[2*i+1]; print_short( (unsigned short) (u%65536) ); print_short( (unsigned short) (u>>16) ); print_short( (unsigned short) (v%65536) ); print_short( (unsigned short) (v>>16) ); } print_crlf(); #else printf( "Size of lane: %d\n", 2*sizeof( unsigned long ) ); for( i=0; i<K_LANES; i++ ){ if( 0==i || 5==i || 10==i || 15==i || 20==i ) printf("\n"); u = A[2*i]; v = A[2*i+1]; printf( "(%5u, %5u, %5u %5u) ", (unsigned int) (u%65536), (unsigned int) (u>>16), (unsigned int) (v%65536), (unsigned int) (v>>16) ); } printf("\n"); #endif KRounds(); #ifdef __TRS80__ /* Display resulting state */ /* for( i=0; i<K_LANES; i++ ){ */ /* if( 0==i || 5==i || 10==i || 15==i || 20==i ) print_crlf(); */ /* print_short( A[i] ); */ /* } */ /* Jump back to BASIC */ __asm ld a,#0x0d ; CR call 0x33 ; Print it ld hl,#0x6cc ; BASIC command line jp (hl) __endasm; #else /* Display resulting state */ for( i=0; i<K_LANES; i++ ){ if( 0==i || 5==i || 10==i || 15==i || 20==i ) printf("\n"); u = A[2*i]; v = A[2*i+1]; printf( "(%5u, %5u, %5u %5u) ", (unsigned int) (u%65536), (unsigned int) (u>>16), (unsigned int) (v%65536), (unsigned int) (v>>16) ); } #endif }
void BB::print() { print_short(); lprintf("(%ld nodes):\n", (void*)nnodes); print_code(false); lprintf("duInfo: "); duInfo.print(); }
void G1OffsetTableContigSpace::print() const { print_short(); gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT ")", bottom(), top(), _offsets.threshold(), end()); }
void ImmutableSpace::print() const { print_short(); tty->print_cr(" [%#-6lx,%#-6lx)", bottom(), end()); }
void OutlinedScope::print(char* name) { print_short(name); lprintf(" _nm = %#lx, _scope = %#lx", _nm, _scope); }