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

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

?? libexo.c.svn-base

?? 模擬多核狀態下龍芯處理器的功能
?? SVN-BASE
?? 第 1 頁 / 共 2 頁
字號:
/*
 * libexo.c - EXO library main line routines
 *
 * This file is a part of the SimpleScalar tool suite written by
 * Todd M. Austin as a part of the Multiscalar Research Project.
 *
 * The tool suite is currently maintained by Doug Burger and Todd M. Austin.
 *
 * Copyright (C) 1997 by Todd M. Austin
 *
 * This source file is distributed "as is" in the hope that it will be
 * useful.  The tool set comes with no warranty, and no author or
 * distributor accepts any responsibility for the consequences of its
 * use. 
 *
 * Everyone is granted permission to copy, modify and redistribute
 * this tool set under the following conditions:
 *
 *    This source code is distributed for non-commercial use only. 
 *    Please contact the maintainer for restrictions applying to 
 *    commercial use.
 *
 *    Permission is granted to anyone to make or distribute copies
 *    of this source code, either as received or modified, in any
 *    medium, provided that all copyright notices, permission and
 *    nonwarranty notices are preserved, and that the distributor
 *    grants the recipient permission for further redistribution as
 *    permitted by this document.
 *
 *    Permission is granted to distribute this file in compiled
 *    or executable form under the same conditions that apply for
 *    source code, provided that either:
 *
 *    A. it is accompanied by the corresponding machine-readable
 *       source code,
 *    B. it is accompanied by a written offer, with no time limit,
 *       to give anyone a machine-readable copy of the corresponding
 *       source code in return for reimbursement of the cost of
 *       distribution.  This written offer must permit verbatim
 *       duplication by anyone, or
 *    C. it is distributed by someone who received only the
 *       executable form, and is accompanied by a copy of the
 *       written offer of source code that they received concurrently.
 *
 * In other words, you are welcome to use, share and improve this
 * source file.  You are forbidden to forbid anyone else to use, share
 * and improve what you give them.
 *
 * INTERNET: dburger@cs.wisc.edu
 * US Mail:  1210 W. Dayton Street, Madison, WI 53706
 *
 * $Id: libexo.c,v 1.1.1.1 2006/09/08 09:21:43 cvsuser Exp $
 *
 * $Log: libexo.c,v $
 * Revision 1.1.1.1  2006/09/08 09:21:43  cvsuser
 * Godson-3 simulator
 *
 * Revision 1.1  2005/01/27 03:18:24  fxzhang
 * create godson2 cvs
 *
 * Revision 1.2  2005/01/27 03:14:38  fxzhang
 * tmp
 *
 * Revision 1.1.1.1  2004/12/05 14:36:29  fxzhang
 * initial import of ss-mips
 *
 * Revision 1.1  2002/09/05 20:26:15  twenisch
 * Simple-Scalar 3.0c.  Changelogs removed.
 *
 *
 */

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
#include <errno.h>
#include <assert.h>

#include "../host.h"
#include "../misc.h"
#include "../mips.h"
#include "libexo.h"

/* EXO term classes print strings */
char *exo_class_str[ec_NUM] = {
  "integer",
  "address",
  "float",
  "char",
  "string"
  "list",
  "array",
  "token",
  "blob"
};

/* return the value of an escape sequence, ESCAPE is a pointer to the first
   character following '\', sets NEXT to first character after escape */
/* A2.5.2 */
static int
intern_escape(char *esc, char **next)
{
  int c, value, empty, count;

  switch (c = *esc++) {
  case 'x':
    /* \xhh hex value */
    value = 0;
    empty = TRUE;
    while (1)
      {
        c = *esc++;
        if (!(c >= 'a' && c <= 'f')
            && !(c >= 'A' && c <= 'F')
            && !(c >= '0' && c <= '9'))
          {
            esc--;
            break;
          }
        value *=16;
        if (c >= 'a' && c <= 'f')
          value += c - 'a' + 10;
        if (c >= 'A' && c <= 'F')
          value += c - 'A' + 10;
        if (c >= '0' && c <= '9')
          value += c - '0';
        empty = FALSE;
      }
    if (empty)
      fatal("\\x used with no trailing hex digits");
    break;

  case '0': case '1': case '2': case '3':
  case '4': case '5': case '6': case '7':
    /* \ooo octal value */
    value = 0;
    count = 0;
    while ((c <= '7') && (c >= '0') && (count++ < 3))
      {
        value = (value * 8) + (c - '0');
        c = *esc++;
      }
    esc--;
    break;

  case '\\':
  case '\'':
  case '"':
    value = c;
    break;

  case 'n':
    value = '\n';
    break;

  case 't':
    value = '\t';
    break;

  case 'r':
    value = '\r';
    break;

  case 'f':
    value = '\f';
    break;

  case 'b':
    value = '\b';
    break;

  case 'a':
    value = '\a';
    break;

  case 'v':
    value = '\v';
    break;

  case '?':
    value = c;
    break;

  case '(':
  case '{':
  case '[':
  case '%':
    value = c;
    warn("non-ANSI escape sequence `\\%c'", c);
    break;

  default:
    fatal("unknown escape, '\\' followed by char %x (`%c')", (int)c, c);
  }

  if (*next)
    *next = esc;

  return value;
}

/* return the value of an character literal sequence */
/* A2.5.2 */
static int
intern_char(char *s, char **next)
{
  unsigned char value;

  if (s[0] != '\'' || s[strlen(s)-1] != '\'')
    panic("mal-formed string constant");

  if (s[1] != '\\')
    {
      value = (unsigned)s[1];
      if (s[2] != '\'')
	panic("mal-formed string constant");
      if (next)
	*next = s + 2;
    }
  else
    {
      /* escaped char constant */
      value = intern_escape(s+2, next);
    }

  /* map to a signed char value */
  value = (signed int)((unsigned char)((unsigned char)((unsigned int)value)));

  if (UCHAR_MAX < value)
    fatal("character constant out of range");

  return value;
}

static void
print_char(unsigned char c, FILE *stream)
{
  switch (c)
    {
    case '\n':
      fprintf(stream, "\\n");
      break;

    case '\\':
      fprintf(stream, "\\\\");
      break;

    case '\'':
      fprintf(stream, "\\'");
      break;

    case '\t':
      fprintf(stream, "\\t");
      break;

    case '\r':
      fprintf(stream, "\\r");
      break;

    case '\f':
      fprintf(stream, "\\f");
      break;

    case '\b':
      fprintf(stream, "\\b");
      break;

    case '\a':
      fprintf(stream, "\\a");
      break;

    case '\v':
      fprintf(stream, "\\v");
      break;

    default:
      if (isprint(c))
	fprintf(stream, "%c", c);
      else
	fprintf(stream, "\\x%02x", c);
    }
}

/* expand all escapes in string STR, return pointer to allocation w/ result */
static char *
intern_string(char *str)
{
  char *s, *istr;

  /* resulting string cannot be longer than STR */
  s = istr = malloc(strlen(str)+1);

  if (!str || !*str || *str != '\"') /* " */
    panic("mal-formed string constant");

  /* skip `"' */ /* " */
  str++;

  while (*str)
    {
      if (*str == '\\')
        *s++ = intern_escape(str+1, &str);
      else
        {
          /* A2.6 */
          if (*str == '\n')
            warn("ANSI C forbids newline in character constant");
          /* A2.6 */
          if (*str == '"' && str[1] != '\0')
            panic("encountered `\"' embedded in string constant");

          if (*str != '\"') /* " */
            *s++ = *str;
          str++;
        }
    }
  *s = '\0';
  return istr;
}

static void
print_string(unsigned char *s, FILE *stream)
{
  while (*s)
    {
      print_char(*s, stream);
      s++;
    }
}

/* bogus token value */
#define TOKEN_BOGON		0

static int token_id = TOKEN_BOGON + 1;

#define TOKEN_HASH_SIZE		1024
struct exo_token_t *token_hash[TOKEN_HASH_SIZE];

/* hash a string */
static unsigned long
hash_str(char *s)
{
  unsigned h = 0;
  while (*s)
    h = (h << 1) + *s++;
  return (h % TOKEN_HASH_SIZE);
}

/* intern token TOKEN_STR */
struct exo_token_t *
exo_intern(char *token_str)		/* string to intern */
{
  int index;
  struct exo_token_t *ent;

  index = hash_str(token_str);

  for (ent=token_hash[index]; ent != NULL; ent=ent->next)
    {
      if (!strcmp(token_str, ent->str))
	{
	  /* got a match, return token entry */
	  return ent;
	}
    }

  /* not found, create a new entry */
  ent = (struct exo_token_t *)calloc(1, sizeof(struct exo_token_t));
  if (!ent)
    fatal("out of virtual memory");

  ent->str = mystrdup(token_str);
  ent->token = token_id++;
  ent->next = token_hash[index];
  token_hash[index] = ent;

  return ent;
}

/* intern token TOKEN_STR as value TOKEN */
struct exo_token_t *
exo_intern_as(char *token_str,		/* string to intern */
	      int token)		/* internment value */
{
  struct exo_token_t *ent;

#if 0
  if (token_id > token)
    fatal("token value is already in use");
#endif

  ent = exo_intern(token_str);
  /* overide the default value */
  ent->token = token;

#if 0
  if (ent->token != token)
    fatal("symbol `%s' was previously interned", token_str);
#endif

  return ent;
}

/* allocate an EXO node, fill in its type */
static struct exo_term_t *
exo_alloc(enum exo_class_t ec)
{
  struct exo_term_t *exo;

  exo = (struct exo_term_t *)calloc(1, sizeof(struct exo_term_t));
  if (!exo)
    fatal("out of virtual memory");
  exo->next = NULL;
  exo->ec = ec;

  return exo;
}


/*
 * create a new EXO term, usage:
 *
 *	exo_new(ec_integer, (exo_integer_t)<int>);
 *	exo_new(ec_address, (exo_integer_t)<int>);
 *	exo_new(ec_float, (exo_float_t)<float>);
 *	exo_new(ec_char, (int)<char>);
 *      exo_new(ec_string, "<string>");
 *      exo_new(ec_list, <list_ent>..., NULL);
 *      exo_new(ec_array, <size>, <array_ent>..., NULL);
 *	exo_new(ec_token, "<token>"); 
*/
struct exo_term_t *
exo_new(enum exo_class_t ec, ...)
{
  struct exo_term_t *exo;
  va_list v;
  va_start(v, ec);

  exo = exo_alloc(ec);
  switch (ec)
    {
    case ec_integer:
      exo->as_integer.val = va_arg(v, exo_integer_t);
      break;

    case ec_address:
      exo->as_address.val = va_arg(v, exo_address_t);
      break;

    case ec_float:
      exo->as_float.val = va_arg(v, exo_float_t);
      break;

    case ec_char:
      exo->as_char.val = va_arg(v, int);
      break;

    case ec_string:
      {
	char *str;

	str = va_arg(v, char *);
	exo->as_string.str = (unsigned char *)mystrdup(str);
      }
      break;

    case ec_list:
      {
	struct exo_term_t *ent;

	exo->as_list.head = NULL;
	do {
	  ent = va_arg(v, struct exo_term_t *);
	  exo->as_list.head = exo_chain(exo->as_list.head, ent);
	} while (ent != NULL);
      }
      break;

    case ec_array:
      {
	int i;
	struct exo_term_t *ent;

	exo->as_array.size = va_arg(v, int);
	exo->as_array.array = (struct exo_term_t **)
	  calloc(exo->as_array.size, sizeof(struct exo_term_t *));
	if (!exo->as_array.array)
	  fatal("out of virtual memory");
	i = 0;
	do {
	  ent = va_arg(v, struct exo_term_t *);
	  if (ent != NULL)
	    {
	      if (i == exo->as_array.size)
		fatal("array constructor overflow");
	      SET_EXO_ARR(exo, i, ent);
	    }
	  i++;
	} while (ent != NULL);
      }
      break;

    case ec_token:
      {
	char *str;

	str = va_arg(v, char *);
	exo->as_token.ent = exo_intern(str);
      }
      break;

    case ec_blob:
      {
	unsigned size;
	unsigned char *data;

	size = va_arg(v, unsigned);
	data = va_arg(v, unsigned char *);

	exo->as_blob.size = size;
	exo->as_blob.data = malloc(size);
	if (data != NULL)
	  memcpy(exo->as_blob.data, data, size);
	else
	  memset(exo->as_blob.data, 0, size);
      }
      break;

    case ec_null:
      break;

    default:
      panic("bogus EXO class");
    }

  va_end(v);
  return exo;
}

/* release an EXO term */
void
exo_delete(struct exo_term_t *exo)
{
  exo->next = NULL;

  switch (exo->ec)
    {
    case ec_integer:
      /* no extra storage */
      exo->as_integer.val = 0;
      break;

    case ec_address:
      /* no extra storage */
      exo->as_address.val = 0;
      break;

    case ec_float:
      /* no extra storage */
      exo->as_float.val = 0.0;
      break;

    case ec_char:
      /* no extra storage */
      exo->as_char.val = '\0';
      break;

    case ec_string:
      free(exo->as_string.str);
      exo->as_string.str = NULL;
      break;

    case ec_list:
      {
	struct exo_term_t *ent, *next_ent;

	for (ent=exo->as_list.head; ent != NULL; ent = next_ent)
	  {
	    next_ent = ent->next;
	    exo_delete(ent);
	  }
	exo->as_list.head = NULL;
      }
      break;

    case ec_array:
      {
	int i;

	for (i=0; i < exo->as_array.size; i++)
	  {
	    if (exo->as_array.array[i] != NULL)
	      exo_delete(exo->as_array.array[i]);
	  }
	free(exo->as_array.array);
	exo->as_array.array = NULL;
	exo->as_array.size = 0;
      }
      break;

    case ec_token:
      /* no extra storage */
      exo->as_token.ent = NULL;
      break;

    case ec_blob:
      /* free the blob data */
      free(exo->as_blob.data);
      exo->as_blob.data = NULL;
      break;

    case ec_null:
      /* no extra storage */
      break;

    default:
      panic("bogus EXO class");
    }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品色噜噜| 日本美女一区二区三区| 精品少妇一区二区三区在线播放| 成人av综合在线| 久久不见久久见免费视频7 | 亚洲另类春色国产| 久久久三级国产网站| 在线播放/欧美激情| 日本电影欧美片| 成人午夜电影小说| 久久成人精品无人区| 丝袜美腿亚洲综合| 亚洲另类色综合网站| 国产精品久久久久久久裸模| 精品国产欧美一区二区| 在线播放亚洲一区| 欧美午夜精品电影| 91香蕉视频在线| 成人午夜电影小说| 高清成人免费视频| 国产91丝袜在线18| 国产一区二区三区久久久| 奇米一区二区三区| 日本一区中文字幕| 日韩精品一区第一页| 亚洲国产精品久久人人爱| 亚洲伦理在线精品| 中文字幕一区二区三区色视频| 久久精品亚洲国产奇米99| 精品av久久707| 337p粉嫩大胆噜噜噜噜噜91av| 日韩欧美亚洲国产精品字幕久久久| 欧美久久免费观看| 91精品蜜臀在线一区尤物| 欧美巨大另类极品videosbest| 欧美日韩国产精品成人| 欧美性感一区二区三区| 欧美日韩中文另类| 欧美精品第1页| 日韩午夜在线播放| 久久久电影一区二区三区| 国产视频一区二区三区在线观看| 精品国产3级a| 国产三级欧美三级| 亚洲色图清纯唯美| 一区二区三区欧美日| 亚洲二区在线视频| 麻豆91在线看| 国产夫妻精品视频| 成人a级免费电影| 在线观看欧美精品| 日韩视频一区二区| 国产嫩草影院久久久久| 中文字幕一区二区三区在线不卡| 一区二区三区中文免费| 午夜伦欧美伦电影理论片| 老司机精品视频在线| 国产传媒欧美日韩成人| 色综合视频在线观看| 欧美日本一道本| 精品免费视频.| 综合久久国产九一剧情麻豆| 亚洲国产sm捆绑调教视频| 久久激情五月婷婷| 成人sese在线| 4438x成人网最大色成网站| 久久综合色天天久久综合图片| 国产夜色精品一区二区av| 亚洲激情图片小说视频| 琪琪久久久久日韩精品| 丁香激情综合五月| 欧美三级在线看| 国产人成亚洲第一网站在线播放| 一区二区久久久| 久久99精品久久久久婷婷| 91农村精品一区二区在线| 欧美一区二区三区在线观看视频| 久久精品日韩一区二区三区| 亚洲成在人线在线播放| 国产精品1024| 69p69国产精品| 国产精品乱码一区二区三区软件| 性欧美大战久久久久久久久| 国产成人aaa| 在线播放日韩导航| 国产精品福利一区| 韩国视频一区二区| 欧美性大战久久久久久久蜜臀| 久久免费午夜影院| 天天射综合影视| 91免费国产在线观看| 欧美不卡一区二区| 午夜私人影院久久久久| 成人免费高清视频在线观看| 欧美一级理论片| 一区二区三区在线影院| 粉嫩av一区二区三区在线播放 | 免费一级欧美片在线观看| 成人午夜在线播放| 精品久久免费看| 丝袜美腿亚洲综合| 在线视频亚洲一区| 日韩美女啊v在线免费观看| 国产麻豆视频精品| 欧美一区二区三区在线观看视频| 亚洲精品免费在线观看| 成人黄色大片在线观看| 久久亚洲一区二区三区四区| 日本vs亚洲vs韩国一区三区| 欧美在线观看18| 亚洲视频一二三| 高清国产午夜精品久久久久久| 精品国产乱码久久久久久牛牛| 婷婷综合在线观看| 欧美亚洲动漫精品| 曰韩精品一区二区| 99精品在线免费| 国产精品免费视频网站| 国产伦精品一区二区三区免费 | 久久久久国产精品厨房| 青青草成人在线观看| 91精品国产综合久久久久久久久久 | 青青草国产精品97视觉盛宴 | 欧美日韩一区二区三区在线| 中文字幕一区二区三区不卡| 国产成人精品免费视频网站| 国产亚洲一本大道中文在线| 激情综合网av| 精品99一区二区| 国产精品一区二区黑丝| 久久欧美一区二区| 国产aⅴ精品一区二区三区色成熟| 2欧美一区二区三区在线观看视频 337p粉嫩大胆噜噜噜噜噜91av | 欧美一区二区三区男人的天堂| 亚洲高清视频中文字幕| 欧美女孩性生活视频| 亚洲成人777| 日韩视频在线一区二区| 久久精品国产免费| 久久精品一区八戒影视| 懂色av中文一区二区三区| 国产精品麻豆网站| 一本久久综合亚洲鲁鲁五月天| 亚洲欧美偷拍另类a∨色屁股| 91欧美一区二区| 午夜精品久久久久久久99樱桃| 欧美日本高清视频在线观看| 理论片日本一区| 国产农村妇女毛片精品久久麻豆| 99精品视频在线观看| 亚洲高清一区二区三区| 欧美成人一区二区三区片免费| 国产中文字幕精品| 亚洲丝袜自拍清纯另类| 欧美性感一类影片在线播放| 日本特黄久久久高潮| 久久综合九色综合欧美就去吻| 国产成人亚洲精品青草天美 | 黄色成人免费在线| 国产清纯在线一区二区www| 不卡一区二区在线| 性久久久久久久久| 久久精品一区二区三区不卡 | 精品无人区卡一卡二卡三乱码免费卡| 精品国产乱码久久久久久夜甘婷婷| 成人午夜av电影| 亚洲综合成人在线| 欧美成人在线直播| 91麻豆免费观看| 欧美aⅴ一区二区三区视频| 国产三级精品视频| 欧美午夜一区二区| 国产一区在线观看麻豆| 一区二区三区在线免费视频 | 精品国产电影一区二区| 不卡的看片网站| 青青草97国产精品免费观看无弹窗版| 日本一区二区在线不卡| 欧美三级视频在线观看| 国产aⅴ精品一区二区三区色成熟| 亚洲国产成人高清精品| 国产目拍亚洲精品99久久精品| 欧美日本一区二区三区四区| 成人va在线观看| 毛片av一区二区三区| 亚洲人一二三区| 精品三级av在线| 欧洲激情一区二区| 国产精品1024久久| 青青草精品视频| 一区二区三区av电影| 国产欧美一区二区精品忘忧草 | 日本黄色一区二区| 国产一区二区三区精品欧美日韩一区二区三区 | 欧美色图第一页| 国产精品一区在线观看乱码| 亚瑟在线精品视频| 亚洲精品中文在线| 国产午夜精品一区二区三区视频 | 欧洲精品一区二区|