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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? chap29.lst

?? These files contain all of the code listings in C: The Complete Reference, 4th Edition The so
?? LST
?? 第 1 頁 / 共 4 頁
字號:
    lvartemp = lvartos;  /* save local var stack index */
    get_args();  /* get function arguments */
    temp = prog; /* save return location */
    func_push(lvartemp);  /* save local var stack index */
    prog = loc;  /* reset prog to start of function */
    get_params(); /* load the function's parameters with
                     the values of the arguments */
    interp_block(); /* interpret the function */
    prog = temp; /* reset the program pointer */
    lvartos = func_pop(); /* reset the local var stack */
  }
}

/* Push the arguments to a function onto the local
   variable stack. */
void get_args(void)
{
  int value, count, temp[NUM_PARAMS];
  struct var_type i;

  count = 0;
  get_token();
  if(*token != '(') sntx_err(PAREN_EXPECTED);

  /* process a comma-separated list of values */
  do {
    eval_exp(&value);
    temp[count] = value;  /* save temporarily */
    get_token();
    count++;
  } while(*token == ',');
  count--;
  /* now, push on local_var_stack in reverse order */
  for(; count>=0; count--) {
    i.value = temp[count];
    i.v_type = ARG;
    local_push(i);
  }
}

/* Get function parameters. */
void get_params(void)
{
  struct var_type *p;
  int i;

  i = lvartos-1;
  do { /* process comma-separated list of parameters */
    get_token();
    p = &local_var_stack[i];
    if(*token != ')' ) {
      if(tok != INT && tok != CHAR)
        sntx_err(TYPE_EXPECTED);

      p->v_type = token_type;
      get_token();

      /* link parameter name with argument already on
         local var stack */
      strcpy(p->var_name, token);
      get_token();
      i--;
    }
    else break;
  } while(*token == ',');
  if(*token != ')') sntx_err(PAREN_EXPECTED);
}

listing 12
/* Return from a function. */
void func_ret(void)
{
  int value;

  value = 0;
  /* get return value, if any */
  eval_exp(&value);

  ret_value = value;
}

listing 13
/* Assign a value to a variable. */
void assign_var(char *var_name, int value)
{
  register int i;

  /* first, see if it's a local variable */
  for(i=lvartos-1; i >= call_stack[functos-1]; i--)  {
    if(!strcmp(local_var_stack[i].var_name, var_name)) {
      local_var_stack[i].value = value;
      return;
    }
  }
  if(i < call_stack[functos-1])
  /* if not local, try global var table */
    for(i=0; i < NUM_GLOBAL_VARS; i++)
      if(!strcmp(global_vars[i].var_name, var_name)) {
        global_vars[i].value = value;
        return;
      }
  sntx_err(NOT_VAR); /* variable not found */
}

listing 14
/* Execute an if statement. */
void exec_if(void)
{
  int cond;

  eval_exp(&cond); /* get if expression */

  if(cond) { /* is true so process target of IF */
    interp_block();
  }
  else { /* otherwise skip around IF block and
            process the ELSE, if present */
    find_eob(); /* find start of next line */
    get_token();

    if(tok != ELSE) {
      putback();  /* restore token if
                     no ELSE is present */
      return;
    }
    interp_block();
  }
}

listing 15
/* Execute a while loop. */
void exec_while(void)
{
  int cond;
  char *temp;

  putback();
  temp = prog;  /* save location of top of while loop */
  get_token();
  eval_exp(&cond);  /* check the conditional expression */
  if(cond) interp_block();  /* if true, interpret */
  else {  /* otherwise, skip around loop */
    find_eob();
    return;
  }
  prog = temp;  /* loop back to top */
}

listing 16
/* Execute a do loop. */
void exec_do(void)
{
  int cond;
  char *temp;

  putback();
  temp = prog;  /* save location of top of do loop */

  get_token(); /* get start of loop */
  interp_block(); /* interpret loop */
  get_token();
  if(tok != WHILE) sntx_err(WHILE_EXPECTED);
  eval_exp(&cond); /* check the loop condition */
  if(cond) prog = temp; /* if true loop; otherwise,
                           continue on */
}

listing 17
/* Execute a for loop. */
void exec_for(void)
{
  int cond;
  char *temp, *temp2;
  int brace ;

  get_token();
  eval_exp(&cond);  /* initialization expression */
  if(*token != ';') sntx_err(SEMI_EXPECTED);
  prog++; /* get past the ; */
  temp = prog;
  for(;;) {
    eval_exp(&cond);  /* check the condition */
    if(*token != ';') sntx_err(SEMI_EXPECTED);
    prog++; /* get past the ; */
    temp2 = prog;

    /* find the start of the for block */
    brace = 1;
    while(brace) {
      get_token();
      if(*token == '(') brace++;
      if(*token == ')') brace--;
    }

    if(cond) interp_block();  /* if true, interpret */
    else {  /* otherwise, skip around loop */
      find_eob();
      return;
    }
    prog = temp2;
    eval_exp(&cond); /* do the increment */
    prog = temp;  /* loop back to top */
  }
}

listing 18
int getche(void);    /* read a character from keyboard and 
                          return its value */
int putch(char ch);  /* write a character to the screen */
int puts(char *s);   /* write a string to the screen */
int getnum(void);    /* read an integer from the keyboard and
                          return its value */
int print(char *s);  /* write a string to the screen */
or
int print(int i);    /* write an integer to the screen */

listing 19
/****** Internal Library Functions *******/

/* Add more of your own, here. */

#include <conio.h>  /* if your compiler does not
                       support this  header file,
                       remove it */
#include <stdio.h>
#include <stdlib.h>

extern char *prog; /* points to current location in program */
extern char token[80]; /* holds string representation of token */
extern char token_type; /* contains type of token */
extern char tok; /* holds the internal representation of token */

enum tok_types {DELIMITER, IDENTIFIER, NUMBER, KEYWORD,
                TEMP, STRING, BLOCK};

/* These are the constants used to call sntx_err() when
   a syntax error occurs. Add more if you like.
   NOTE: SYNTAX is a generic error message used when
   nothing else seems appropriate.
*/
enum error_msg
     {SYNTAX, UNBAL_PARENS, NO_EXP, EQUALS_EXPECTED,
      NOT_VAR, PARAM_ERR, SEMI_EXPECTED,
      UNBAL_BRACES, FUNC_UNDEF, TYPE_EXPECTED,
      NEST_FUNC, RET_NOCALL, PAREN_EXPECTED,
      WHILE_EXPECTED, QUOTE_EXPECTED, NOT_STRING,
      TOO_MANY_LVARS, DIV_BY_ZERO};

int get_token(void);
void sntx_err(int error), eval_exp(int *result);
void putback(void);

/* Get a character from console. (Use getchar() if
   your compiler does not support _getche().) */
int call_getche()
{
  char ch;
  ch = _getche();
  while(*prog!=')') prog++;
  prog++;   /* advance to end of line */
  return ch;
}

/* Put a character to the display. */
int call_putch()
{
  int value;

  eval_exp(&value);
  printf("%c", value);
  return value;
}

/* Call puts(). */
int call_puts(void)
{
  get_token();
  if(*token!='(') sntx_err(PAREN_EXPECTED);
  get_token();
  if(token_type!=STRING) sntx_err(QUOTE_EXPECTED);
  puts(token);
  get_token();
  if(*token!=')') sntx_err(PAREN_EXPECTED);

  get_token();
  if(*token!=';') sntx_err(SEMI_EXPECTED);
  putback();
  return 0;
}

/* A built-in console output function. */
int print(void)
{
  int i;

  get_token();
  if(*token!='(')  sntx_err(PAREN_EXPECTED);

  get_token();
  if(token_type==STRING) { /* output a string */
    printf("%s ", token);
  }
  else {  /* output a number */
   putback();
   eval_exp(&i);
   printf("%d ", i);
  }

  get_token();

  if(*token!=')') sntx_err(PAREN_EXPECTED);

  get_token();
  if(*token!=';') sntx_err(SEMI_EXPECTED);
  putback();
  return 0;
}

/* Read an integer from the keyboard. */
int getnum(void)
{
  char s[80];

  gets(s);
  while(*prog != ')') prog++;
  prog++;  /* advance to end of line */
  return atoi(s);
}


listing 20
/* Little C Demonstration Program #1.

   This program demonstrates all features
   of C that are recognized by Little C.
*/

int i, j;   /* global vars */
char ch;

int main()
{
  int i, j;  /* local vars */

  puts("Little C Demo Program.");

  print_alpha();

  do {
    puts("enter a number (0 to quit): ");
    i = getnum();
    if(i < 0 ) {
      puts("numbers must be positive, try again");
    }
    else {
      for(j = 0; j < i; j=j+1) {
        print(j);
        print("summed is");
        print(sum(j));
        puts("");
      }
    }
  } while(i!=0);

  return 0;
}

/* Sum the values between 0 and num. */
int sum(int num)
{
  int running_sum;

  running_sum = 0;

  while(num) {
    running_sum = running_sum + num;
    num = num - 1;
  }
  return running_sum;
}

/* Print the alphabet. */
int print_alpha()
{
  for(ch = 'A'; ch<='Z'; ch = ch + 1) {
    putch(ch);
  }
  puts("");

  return 0;
}

listing 21
/* Nested loop example. */
int main()
{
  int i, j, k;

  for(i = 0; i < 5; i = i + 1) {
    for(j = 0; j < 3; j = j + 1) {
      for(k = 3; k ; k = k - 1) {
        print(i);
        print(j);
        print(k);
        puts("");
      }
    }
  }
  puts("done");

  return 0;
}

listing 22
/* Assigments as operations. */
int main()
{
  int a, b;

  a = b = 10;

  print(a); print(b);

  while(a=a-1) {
    print(a);
    do {
       print(b);
    } while((b=b-1) > -10);
  }

  return 0;
}

listing 23
/* This program demonstrates recursive functions. */

/* return the factorial of i */
int factr(int i)
{
  if(i<2) {
    return 1;
  }
  else {
     return i * factr(i-1);
  }
}

int main()
{
  print("Factorial of 4 is: ");
  print(factr(4));

  return 0;
}

listing 24
/* A more rigorous example of function arguments. */

int f1(int a, int b)
{
  int count;

  print("in f1");

  count = a;
  do {
    print(count);
  } while(count=count-1);

  print(a); print(b);
  print(a*b);
  return a*b;
}

int f2(int a, int x, int y)
{
  print(a); print(x);
  print(x / a);
  print(y*x);

  return 0;
}

int main()
{
  f2(10, f1(10, 20), 99);

  return 0;
}

listing 25
/* The loop statements. */
int main()
{
  int a;
  char ch;

  /* the while */
  puts("Enter a number: ");
  a = getnum();
  while(a) {
    print(a);
    print(a*a);
    puts("");
    a = a - 1;
  }

  /* the do-while */
  puts("enter characters, 'q' to quit");
  do {
     ch = getche();
  } while(ch !='q');

  /* the for */
  for(a=0; a<10; a = a + 1) {
     print(a);
  }

  return 0;
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人免费精品视频| 国产老妇另类xxxxx| 国产精品丝袜一区| 久久嫩草精品久久久精品| 精品国产乱码久久久久久夜甘婷婷 | 91蝌蚪porny| av成人老司机| 色综合夜色一区| 在线亚洲高清视频| 欧美精品三级在线观看| 在线91免费看| 精品成人在线观看| 国产欧美精品国产国产专区| 26uuu国产一区二区三区| 久久精品网站免费观看| 欧美精彩视频一区二区三区| 国产欧美精品日韩区二区麻豆天美| 国产亚洲精品久| 国产精品污污网站在线观看| 国产精品激情偷乱一区二区∴| 亚洲天堂福利av| 亚洲一区二区不卡免费| 美女脱光内衣内裤视频久久网站| 狠狠色丁香久久婷婷综合_中 | 成人a区在线观看| 91社区在线播放| 在线观看91av| 久久精品欧美日韩| 一区二区三区电影在线播| 婷婷开心激情综合| 国产老妇另类xxxxx| 色偷偷久久一区二区三区| 91麻豆精品国产91久久久更新时间| 亚洲精品在线三区| 亚洲视频你懂的| 美女视频第一区二区三区免费观看网站| 国产精品99精品久久免费| 91福利资源站| 久久精品日韩一区二区三区| 亚洲裸体xxx| 国产乱子伦视频一区二区三区 | 韩国三级在线一区| 91福利在线免费观看| 精品国产免费人成电影在线观看四季| 中文字幕一区二区三| 久久国产婷婷国产香蕉| 日本精品视频一区二区| 久久精品一区蜜桃臀影院| 五月天网站亚洲| 91美女在线看| 日本一区二区视频在线| 美女mm1313爽爽久久久蜜臀| 在线亚洲人成电影网站色www| 久久久亚洲午夜电影| 午夜精品影院在线观看| 99久久国产综合精品女不卡| 欧美精品一区二区精品网| 日韩av网站免费在线| 色欧美乱欧美15图片| 国产精品人妖ts系列视频| 精品在线视频一区| 日韩欧美高清在线| 婷婷开心激情综合| 欧美精品黑人性xxxx| 亚洲一区二区偷拍精品| 色噜噜狠狠成人中文综合 | 99麻豆久久久国产精品免费 | 色爱区综合激月婷婷| 国产精品免费人成网站| 国产精品996| 日本一区二区三级电影在线观看| 蜜桃一区二区三区在线观看| 欧美精品在线视频| 亚州成人在线电影| 欧美美女一区二区| 首页国产丝袜综合| 欧美另类久久久品| 免费观看一级特黄欧美大片| 精品视频一区 二区 三区| 亚洲国产日韩精品| 欧美日本一区二区| 日本一不卡视频| xnxx国产精品| 大胆亚洲人体视频| 亚洲私人影院在线观看| 在线精品视频一区二区| 日日骚欧美日韩| 日韩久久久精品| 国产精品一区二区在线播放| 国产精品美女久久久久高潮| 成人黄色片在线观看| 亚洲精品一二三| 9191成人精品久久| 久久99精品国产.久久久久久| 精品乱码亚洲一区二区不卡| 国产精品综合二区| 日韩毛片一二三区| 欧美二区乱c少妇| 国产一区二区三区在线观看免费视频 | 亚洲一区二区在线观看视频 | 91精品在线麻豆| 国产精品主播直播| 亚洲精品成人少妇| 日韩视频一区二区三区在线播放| 国产成人在线观看免费网站| 亚洲精选在线视频| 日韩视频一区二区| 91亚洲精品乱码久久久久久蜜桃| 亚洲h动漫在线| 精品1区2区在线观看| 色呦呦国产精品| 精品在线播放免费| 亚洲综合久久av| 久久久不卡影院| 欧美日韩午夜精品| aaa亚洲精品一二三区| 日韩和欧美一区二区三区| 中文字幕国产一区二区| 欧美久久高跟鞋激| 99视频有精品| 国产激情视频一区二区在线观看| 一区二区高清视频在线观看| 国产视频一区二区在线观看| 欧美日韩精品一区二区三区| 成人国产电影网| 激情成人午夜视频| 三级欧美韩日大片在线看| 成人免费一区二区三区视频| 欧美成人一级视频| 8x8x8国产精品| 在线视频你懂得一区| 大美女一区二区三区| 国产一区二区三区综合| 秋霞国产午夜精品免费视频| 亚洲国产精品久久人人爱 | 欧美色中文字幕| 91色porny在线视频| 成人爱爱电影网址| 国产宾馆实践打屁股91| 精品一区二区三区免费观看 | 色菇凉天天综合网| av影院午夜一区| 国产乱码精品一区二区三区五月婷| 日韩中文字幕av电影| 午夜影院在线观看欧美| 亚洲高清中文字幕| 亚洲第一主播视频| jlzzjlzz亚洲日本少妇| 国产一区二区日韩精品| 精品一区二区在线观看| 免费人成精品欧美精品 | 国产精品污网站| 久久精品无码一区二区三区| 久久亚洲精精品中文字幕早川悠里 | 91麻豆精品国产91久久久久 | 成人av电影免费在线播放| 成人h精品动漫一区二区三区| 懂色av一区二区夜夜嗨| 国产成人一区在线| 91麻豆国产福利在线观看| 91影院在线观看| 欧美亚洲愉拍一区二区| 欧美日产国产精品| 日韩精品专区在线影院观看| www成人在线观看| 中文字幕成人网| 亚洲欧美国产77777| 午夜欧美电影在线观看| 久久er99精品| 成人黄动漫网站免费app| 972aa.com艺术欧美| 欧美色图免费看| 日韩亚洲欧美成人一区| 久久―日本道色综合久久| 国产精品看片你懂得| 一级女性全黄久久生活片免费| 午夜av电影一区| 国产精品99久久久久久有的能看 | 国产片一区二区| 亚洲免费资源在线播放| 日韩国产高清在线| 国产精品一色哟哟哟| 色综合欧美在线视频区| 91精品国产综合久久精品app| 久久亚洲私人国产精品va媚药| 亚洲欧美自拍偷拍| 看国产成人h片视频| 色偷偷一区二区三区| 精品国产一区二区三区不卡| 中文字幕一区二区三区在线观看| 亚洲.国产.中文慕字在线| 成人综合在线视频| 欧美丰满一区二区免费视频| 日本一二三四高清不卡| 偷拍亚洲欧洲综合| 97aⅴ精品视频一二三区| 日韩欧美精品在线视频| 亚洲在线视频一区| 风间由美一区二区av101| 制服丝袜一区二区三区|