亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? wc.w

?? 著名算法大師高爺爺設(shè)計的語言。此語言結(jié)合了Tex和C
?? W
字號:
% wc: An example of CWEB by Silvio Levy and Donald E. Knuth\nocon % omit table of contents\datethis % print date on listing\def\SPARC{SPARC\-\kern.1em station}@* An example of {\tt CWEB}.  This example, based on a program byKlaus Guntermann and Joachim Schrod [{\sl TUGboat\/ \bf7} (1986),134--137] presents the ``word count'' program from \UNIX/, rewritten in\.{CWEB} to demonstrate literate programming in \CEE/.  The level ofdetail in this document is intentionally high, for didactic purposes;many of the things spelled out here don't need to be explained inother programs.The purpose of \.{wc} is to count lines, words, and/or characters in alist of files. The number of lines in a file is the number of newlinecharacters it contains. The number of characters is the file length in bytes.A ``word'' is a maximal sequence of consecutive characters other thannewline, space, or tab, containing at least one visible ASCII code.(We assume that the standard ASCII code is in use.)This version of \.{wc} has a nonstandard ``silent'' option (\.{-s}),which suppresses printing except for the grand totals over all files.@ Most \.{CWEB} programs share a common structure.  It's probably agood idea to state the overall structure explicitly at the outset,even though the various parts could all be introduced in unnamedsections of the code if we wanted to add them piecemeal.Here, then, is an overview of the file \.{wc.c} that is definedby this \.{CWEB} program \.{wc.w}:@c@<Header files to include@>@/@<Global variables@>@/@<Functions@>@/@<The main program@>@ We must include the standard I/O definitions, since we want to sendformatted output to |stdout| and |stderr|.@<Header files...@>=#include <stdio.h>@  The |status| variable will tell the operating system if the run wassuccessful or not, and |prog_name| is used in case there's an error message tobe printed.@d OK 0 /* |status| code for successful run */@d usage_error 1 /* |status| code for improper syntax */@d cannot_open_file 2 /* |status| code for file access error */@<Global variables@>=int status=OK; /* exit status of command, initially |OK| */char *prog_name; /* who we are */@ Now we come to the general layout of the |main| function. @<The main...@>=main (argc,argv)    int argc; /* the number of arguments on the \UNIX/ command line */    char **argv; /* the arguments themselves, an array of strings */{  @<Variables local to |main|@>@;  prog_name=argv[0];  @<Set up option selection@>;  @<Process all the files@>;  @<Print the grand totals if there were multiple files @>;  exit(status);}@ If the first argument begins with a `\.{-}', the user is choosingthe desired counts and specifying the order in which they should bedisplayed.  Each selection is given by the initial character(lines, words, or characters).  For example, `\.{-cl}' would causejust the number of characters and the number of lines to be printed,in that order. The default, if no special argument is given, is `\.{-lwc}'.We do not process this string now; we simply remember where it is.It will be used to control the formatting at output time.If the `\.{-}' is immediately followed by `\.{s}', only summary totalsare printed.@<Var...@>=int file_count; /* how many files there are */char *which; /* which counts to print */int silent=0; /* nonzero if the silent option was selected */@ @<Set up o...@>=which="lwc"; /* if no option is given, print all three values */if (argc>1 && *argv[1] == '-') {  argv[1]++;  if (*argv[1]=='s') silent=1,argv[1]++;  if (*argv[1]) which=argv[1];  argc--; argv++;}file_count=argc-1;@ Now we scan the remaining arguments and try to open a file, ifpossible.  The file is processed and its statistics are given.We use a |do|~\dots~|while| loop because we should read from thestandard input if no file name is given.@<Process...@>=argc--;do@+{  @<If a file is given, try to open |*(++argv)|; |continue| if unsuccessful@>;  @<Initialize pointers and counters@>;  @<Scan file@>;  @<Write statistics for file@>;  @<Close file@>;  @<Update grand totals@>; /* even if there is only one file */}@+while (--argc>0);@ Here's the code to open the file.  A special trick allows us tohandle input from |stdin| when no name is given.Recall that the file descriptor to |stdin| is~0; that's what weuse as the default initial value.@<Variabl...@>=int fd=0; /* file descriptor, initialized to |stdin| */@ @d READ_ONLY 0 /* read access code for system |open| routine */@<If a file...@>=if (file_count>0 && (fd=open(*(++argv),READ_ONLY))<0) {  fprintf (stderr, "%s: cannot open file %s\n", prog_name, *argv);@.cannot open file@>  status|=cannot_open_file;  file_count--;  continue;}@ @<Close file@>=close(fd);@ We will do some homemade buffering in order to speed things up: Characterswill be read into the |buffer| array before we process them.To do this we set up appropriate pointers and counters.@d buf_size BUFSIZ /* \.{stdio.h}'s |BUFSIZ| is chosen for efficiency*/@<Var...@>=char buffer[buf_size]; /* we read the input into this array */register char *ptr; /* the first unprocessed character in |buffer| */register char *buf_end; /* the first unused position in |buffer| */register int c; /* current character, or number of characters just read */int in_word; /* are we within a word? */long word_count, line_count, char_count; /* number of words, lines,     and characters found in the file so far */@ @<Init...@>=ptr=buf_end=buffer; line_count=word_count=char_count=0; in_word=0;@ The grand totals must be initialized to zero at the beginning of theprogram. If we made these variables local to |main|, we would have todo this initialization explicitly; however, \CEE/'s globals are automaticallyzeroed. (Or rather, ``statically zeroed.'') (Get it?)@^Joke@>@<Global var...@>=long tot_word_count, tot_line_count, tot_char_count; /* total number of words, lines, and chars */@ The present section, which does the counting that is \.{wc}'s {\it raisond'\^etre}, was actually one of the simplest to write. We look at eachcharacter and change state if it begins or ends a word.@<Scan...@>=while (1) {  @<Fill |buffer| if it is empty; |break| at end of file@>;  c=*ptr++;  if (c>' ' && c<0177) { /* visible ASCII codes */    if (!in_word) {word_count++; in_word=1;}    continue;  }  if (c=='\n') line_count++;  else if (c!=' ' && c!='\t') continue;  in_word=0; /* |c| is newline, space, or tab */}@ Buffered I/O allows us to count the number of characters almost for free.@<Fill |buff...@>=if (ptr>=buf_end) {  ptr=buffer; c=read(fd,ptr,buf_size);  if (c<=0) break;  char_count+=c; buf_end=buffer+c;}@ It's convenient to output the statistics by defining a new function|wc_print|; then the same function can be used for the totals.Additionally we must decide here if we know the name of the filewe have processed or if it was just |stdin|.@<Write...@>=if (!silent) {  wc_print(which, char_count, word_count, line_count);  if (file_count) printf (" %s\n", *argv); /* not |stdin| */  else printf ("\n"); /* |stdin| */}@ @<Upda...@>=tot_line_count+=line_count;tot_word_count+=word_count;tot_char_count+=char_count;@ We might as well improve a bit on \UNIX/'s \.{wc} by displaying thenumber of files too.@<Print the...@>=if (file_count>1 || silent) {  wc_print(which, tot_char_count, tot_word_count, tot_line_count);  if (!file_count) printf("\n");  else printf(" total in %d file%s\n",file_count,file_count>1?"s":"");}@ Here now is the function that prints the values according to thespecified options.  The calling routine is supposed to supply anewline. If an invalid option character is found we informthe user about proper usage of the command. Counts are printed in8-digit fields so that they will line up in columns.@d print_count(n) printf("%8ld",n)@<Fun...@>=wc_print(which, char_count, word_count, line_count)char *which; /* which counts to print */long char_count, word_count, line_count; /* given totals */{  while (*which)     switch (*which++) {    case 'l': print_count(line_count); break;    case 'w': print_count(word_count); break;    case 'c': print_count(char_count); break;    default: if ((status & usage_error)==0) {        fprintf (stderr, "\nUsage: %s [-lwc] [filename ...]\n", prog_name);@.Usage: ...@>        status|=usage_error;      }    }}@ Incidentally, a test of this program against the system \.{wc}command on a \SPARC\ showed that the ``official'' \.{wc} was slightlyslower. Furthermore, although that \.{wc} gave an appropriate errormessage for the options `\.{-abc}', it made no complaints about theoptions `\.{-labc}'! Dare we suggest that the system routine might have beenbetter if its programmer had used a more literate approach?@* Index.Here is a list of the identifiers used, and where they appear. Underlinedentries indicate the place of definition. Error messages are also shown.

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久99精品久久| 99视频超级精品| 国产精品天天摸av网| 91福利社在线观看| 精品亚洲porn| 亚洲主播在线观看| 久久久www成人免费毛片麻豆| 在线精品视频一区二区| 国产超碰在线一区| 免费一级欧美片在线观看| 中文字幕一区二区三中文字幕| 日韩午夜激情视频| 色网综合在线观看| 粉嫩aⅴ一区二区三区四区五区| 亚洲chinese男男1069| 中文字幕日韩av资源站| 日韩免费电影网站| 欧美乱妇23p| 色94色欧美sute亚洲线路一ni| 国产成人夜色高潮福利影视| 麻豆高清免费国产一区| 亚洲国产精品视频| 亚洲精品大片www| 国产精品福利影院| 国产三级精品视频| 久久夜色精品国产噜噜av | 成人app网站| 国产剧情一区在线| 久久爱www久久做| 秋霞电影一区二区| 日本欧美久久久久免费播放网| 亚洲自拍偷拍欧美| 亚洲国产三级在线| 亚洲国产综合色| 一区二区激情小说| 亚洲一区二区在线观看视频 | 国产精品成人免费精品自在线观看| 精品国产电影一区二区| 日韩欧美自拍偷拍| 日韩免费观看2025年上映的电影| 欧美一级欧美一级在线播放| 欧美人xxxx| 欧美三级电影网| 欧美日韩国产另类不卡| 8v天堂国产在线一区二区| 欧美三级中文字幕在线观看| 在线视频一区二区三区| 91福利在线导航| 欧美日韩和欧美的一区二区| 91精品91久久久中77777| 在线观看成人免费视频| 精品视频999| 91精品国产一区二区三区| 91精品国产色综合久久不卡蜜臀 | 亚洲h精品动漫在线观看| 亚洲va欧美va国产va天堂影院| 日欧美一区二区| 久久精品国产网站| 国产精一品亚洲二区在线视频| 国产99久久久精品| 91麻豆视频网站| 欧美高清视频www夜色资源网| 日韩欧美电影在线| 国产日产精品1区| 亚洲精品伦理在线| 视频一区二区国产| 国产福利一区二区| 一本大道久久精品懂色aⅴ| 欧美久久免费观看| 久久夜色精品国产欧美乱极品| 亚洲人成7777| 日韩国产精品大片| 国产精品一区二区男女羞羞无遮挡 | 丝袜脚交一区二区| 国产在线精品一区二区夜色| 不卡电影一区二区三区| 色婷婷精品久久二区二区蜜臀av| 6080午夜不卡| 中文字幕乱码日本亚洲一区二区| 一区二区免费在线播放| 国产一区二区91| 欧美最新大片在线看 | 国产女人18水真多18精品一级做| 一区二区三区免费| 国产一区美女在线| 在线免费观看日本一区| 337p日本欧洲亚洲大胆色噜噜| 亚洲日本免费电影| 捆绑调教美女网站视频一区| 色综合天天综合狠狠| 色狠狠色噜噜噜综合网| 日韩丝袜美女视频| 亚洲欧美在线另类| 黄网站免费久久| 91国产精品成人| 欧美激情综合在线| 日韩精品国产精品| 91啦中文在线观看| 欧美精品一区二区三区高清aⅴ| 亚洲精品免费看| 国产精品1区二区.| 欧美一区二区三区在线电影| 亚洲欧美日韩中文播放| 国产在线精品不卡| 欧美一区二区三区不卡| 有码一区二区三区| 成人免费视频免费观看| 精品成人a区在线观看| 亚洲国产精品久久久久婷婷884| 成人av在线资源网站| 日韩欧美中文字幕公布| 一区二区三区成人| 不卡一区二区中文字幕| 久久午夜国产精品| 日韩国产在线一| 欧美偷拍一区二区| 亚洲女人的天堂| 风流少妇一区二区| 日韩三级中文字幕| 视频一区二区欧美| 欧美日韩一区二区在线视频| 亚洲精品久久久蜜桃| 成人avav在线| 一区在线中文字幕| 粉嫩欧美一区二区三区高清影视| 久久亚洲欧美国产精品乐播 | 精品国产伦一区二区三区观看方式 | 激情欧美一区二区| 51精品国自产在线| 肉肉av福利一精品导航| 欧美日韩一区二区电影| 一区二区三区产品免费精品久久75| 91美女视频网站| 一区二区三区欧美在线观看| 色av一区二区| 亚洲在线视频免费观看| 色妞www精品视频| 亚洲手机成人高清视频| 一本色道久久综合亚洲aⅴ蜜桃| 国产精品福利电影一区二区三区四区| 丁香婷婷深情五月亚洲| 中文字幕中文字幕一区| av在线综合网| 一级日本不卡的影视| 色www精品视频在线观看| 亚洲国产毛片aaaaa无费看 | 欧美成人女星排行榜| 精品制服美女久久| 久久人人97超碰com| 成人午夜视频在线| 亚洲免费在线观看| 欧美午夜一区二区三区| 日韩国产在线观看| 久久久久久久久久久久电影| 成人免费毛片a| 玉足女爽爽91| 欧美高清性hdvideosex| 国产一区二区不卡在线| 中文字幕一区二区不卡| 波多野结衣在线一区| 亚洲欧美日韩国产成人精品影院 | 亚洲成人精品一区| 日韩一区二区三区观看| 狠狠色丁香婷婷综合| 国产精品理论片在线观看| 91行情网站电视在线观看高清版| 亚洲电影一区二区| 精品久久久久久综合日本欧美| 国产91丝袜在线播放0| 亚洲最色的网站| 日韩欧美一二三| a美女胸又www黄视频久久| 午夜影视日本亚洲欧洲精品| 精品噜噜噜噜久久久久久久久试看| 成人免费毛片a| 日韩精品91亚洲二区在线观看| 国产亚洲精品超碰| 欧洲色大大久久| 国产一区二区三区四区在线观看| 亚洲色图一区二区| 日韩欧美成人午夜| gogo大胆日本视频一区| 午夜av电影一区| 亚洲国产精品精华液2区45| 欧美日韩国产首页| 国产一区二区三区美女| 亚洲自拍偷拍av| 欧美国产视频在线| 欧美一区二区三区白人| 99精品国产一区二区三区不卡| 久久久久成人黄色影片| 在线视频欧美区| 寂寞少妇一区二区三区| 亚洲网友自拍偷拍| 国产精品国产自产拍在线| 精品少妇一区二区三区在线播放 | 成人性视频免费网站| 午夜国产精品一区| 国产精品视频yy9299一区| 91.xcao|