亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
日本一区二区视频在线观看| 久久女同性恋中文字幕| 一区二区三区欧美| 色综合天天天天做夜夜夜夜做| 日韩一区欧美一区| 欧美日韩美女一区二区| 日韩精品亚洲专区| 久久女同性恋中文字幕| a在线播放不卡| 午夜精品一区在线观看| 制服丝袜中文字幕一区| 国产麻豆精品在线观看| 中文字幕一区二区5566日韩| 精品视频在线免费看| 另类的小说在线视频另类成人小视频在线| 欧美精品一区二区三区在线播放| 国产91丝袜在线观看| 亚洲毛片av在线| 在线成人小视频| 国产福利精品一区二区| 一区二区激情小说| 精品成人佐山爱一区二区| 99久久伊人网影院| 日韩电影免费在线| 成人免费在线视频| 日韩午夜中文字幕| 99在线热播精品免费| 蜜臀久久99精品久久久画质超高清| 2024国产精品| 欧美日韩久久久一区| 国产一区二区三区日韩| 亚洲一区二区三区四区中文字幕| 精品噜噜噜噜久久久久久久久试看| 成人精品在线视频观看| 秋霞av亚洲一区二区三| 亚洲日穴在线视频| 久久婷婷综合激情| 777精品伊人久久久久大香线蕉| 国产高清亚洲一区| 蜜桃一区二区三区在线观看| 亚洲精品成人天堂一二三| 久久久久久影视| 91精品国产91久久久久久最新毛片| 成人一区二区三区视频| 精品在线亚洲视频| 亚洲综合av网| 国产精品国产三级国产有无不卡| 日韩视频免费观看高清完整版| 91久久线看在观草草青青| 国产成人午夜高潮毛片| 麻豆91精品视频| 性久久久久久久| 亚洲欧美日韩在线不卡| 国产欧美日产一区| 久久久亚洲欧洲日产国码αv| 8x8x8国产精品| 欧美一a一片一级一片| www.亚洲激情.com| 国产精品99久久久久久久vr| 欧美aaaaa成人免费观看视频| 亚洲精选免费视频| 综合激情成人伊人| 国产精品二区一区二区aⅴ污介绍| 精品噜噜噜噜久久久久久久久试看 | 国产精品全国免费观看高清| 欧美一区二区三区男人的天堂| 欧美性受xxxx| 欧美色爱综合网| 91美女视频网站| 99精品久久99久久久久| 成人97人人超碰人人99| 成人深夜在线观看| 成人午夜av影视| 丰满少妇在线播放bd日韩电影| 国产在线不卡一区| 麻豆高清免费国产一区| 麻豆国产精品一区二区三区| 精品一区二区三区在线观看国产| 欧美aaa在线| 狠狠色狠狠色综合系列| 国产美女视频91| 国产福利电影一区二区三区| 成人手机在线视频| 成人av动漫网站| 色呦呦日韩精品| 欧美日韩第一区日日骚| 91精品欧美久久久久久动漫| 日韩三级在线观看| 久久九九影视网| 国产精品麻豆网站| 一区二区久久久| 喷水一区二区三区| 国产盗摄视频一区二区三区| 99国产精品久久| 欧美日韩精品欧美日韩精品| 欧美疯狂做受xxxx富婆| 欧美妇女性影城| 久久久三级国产网站| 日韩美女视频一区二区| 亚洲电影一区二区| 久久爱www久久做| 99久久精品国产观看| 色播五月激情综合网| 欧美日韩高清一区二区不卡| 日韩免费视频一区二区| 久久一区二区视频| 亚洲激情图片qvod| 免费久久精品视频| 丁香婷婷综合色啪| 欧美日韩不卡一区二区| 久久影视一区二区| 亚洲激情图片qvod| 国产一区二区毛片| 欧美在线观看禁18| 精品国产一区二区三区av性色| 1000精品久久久久久久久| 亚州成人在线电影| 国产91精品在线观看| 欧美色网一区二区| 国产欧美一区二区精品性| 亚洲电影视频在线| 高清国产午夜精品久久久久久| 欧美日韩成人综合| 国产精品天美传媒沈樵| 麻豆视频一区二区| 一本色道久久综合狠狠躁的推荐| 欧美成人一级视频| 亚洲午夜三级在线| 成人国产精品免费观看| 日韩欧美在线影院| 一区二区免费看| 成人一区在线观看| 精品福利一二区| 视频在线观看一区二区三区| 成人福利视频网站| 精品国产3级a| 日产国产高清一区二区三区| 91视频在线观看免费| 国产网站一区二区| 久久99精品久久久久| 欧美性色欧美a在线播放| 18成人在线观看| 国产白丝精品91爽爽久久| 日韩三级伦理片妻子的秘密按摩| 亚洲一区二区在线视频| 丁香亚洲综合激情啪啪综合| 精品久久久久99| 日本中文字幕一区二区视频| 欧美色图在线观看| 亚洲人成网站影音先锋播放| 国产盗摄一区二区| 久久久精品国产免大香伊 | 亚洲地区一二三色| 91丨porny丨在线| 1024亚洲合集| aaa欧美色吧激情视频| 欧美国产精品专区| 狠狠狠色丁香婷婷综合激情| 欧美一级艳片视频免费观看| 婷婷成人综合网| 91福利资源站| 亚洲精品一二三区| 日本精品免费观看高清观看| 中文字幕中文字幕中文字幕亚洲无线| 国产盗摄精品一区二区三区在线| 26uuu国产一区二区三区| 精品一区二区三区久久久| 精品欧美一区二区三区精品久久| 日本美女视频一区二区| 欧美一区二区福利视频| 玖玖九九国产精品| 精品国产亚洲在线| 国产精品一区在线| 国产欧美va欧美不卡在线| 成人激情综合网站| 中文字幕一区二区三区乱码在线| bt欧美亚洲午夜电影天堂| 亚洲免费观看高清完整版在线观看| 91黄色激情网站| 亚洲一二三区不卡| 91精品国产综合久久久久| 蜜桃视频在线一区| 久久男人中文字幕资源站| 成人动漫一区二区| 亚洲精品国产无套在线观| 欧美色手机在线观看| 麻豆一区二区三区| 国产日韩精品久久久| 99精品视频免费在线观看| 亚洲一二三区不卡| 欧美哺乳videos| 成人性视频免费网站| 亚洲一区在线观看网站| 日韩欧美卡一卡二| av在线一区二区三区| 亚洲h在线观看| 久久天堂av综合合色蜜桃网| 91在线一区二区| 日日噜噜夜夜狠狠视频欧美人| 久久综合九色综合97_久久久|