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

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

?? history.c

?? BCAST Implementation for NS2
?? C
?? 第 1 頁 / 共 4 頁
字號:
  if(!glh)    return bufsize > 0;/* * If the new size doesn't differ from the existing size, do nothing. */  if(glh->buflen == bufsize)    return 0;/* * Cancel any ongoing search. */  (void) _glh_cancel_search(glh);/* * Create a wholly new buffer? */  if(glh->buflen == 0) {    glh->buffer = (char *) malloc(bufsize);    if(!glh->buffer)      return 1;    glh->buflen = bufsize;/* * Delete an existing buffer? */  } else if(bufsize == 0) {    _glh_clear_history(glh, 1);    free(glh->buffer);    glh->buffer = NULL;    glh->buflen = 0;/* * To get here, we must be shrinking or expanding from one * finite size to another. */  } else {/* * If we are shrinking the size of the buffer, then we first need * to discard the oldest lines that won't fit in the new buffer. */    if(bufsize < glh->buflen) {      size_t nbytes = 0;    /* The number of bytes used in the new buffer */      GlLineNode *oldest;   /* The oldest node to be kept *//* * Searching backwards from the youngest line, find the oldest * line for which there will be sufficient room in the new buffer. */      for(oldest = glh->list.tail;	  oldest && (nbytes += oldest->nchar) <= bufsize;	  oldest = oldest->prev)	;/* * We will have gone one node too far, unless we reached the oldest line * without exceeding the target length. */      if(oldest) {	nbytes -= oldest->nchar;	oldest = oldest->next;      };/* * Discard the nodes that can't be retained. */      while(glh->list.head && glh->list.head != oldest)	_glh_discard_node(glh, glh->list.head);/* * If we are increasing the size of the buffer, we need to reallocate * the buffer before shifting the lines into their new positions. */    } else {      char *new_buffer = (char *) realloc(glh->buffer, bufsize);      if(!new_buffer)	return 1;      glh->buffer = new_buffer;      glh->buflen = bufsize;    };/* * If there are any lines to be preserved, copy the block of lines * that precedes the end of the existing buffer to what will be  * the end of the new buffer. */    if(glh->list.head) {      int shift;  /* The number of bytes to shift lines in the buffer *//* * Get the oldest line to be kept. */      GlLineNode *oldest = glh->list.head;/* * Count the number of characters that are used in the lines that * precede the end of the current buffer (ie. not including those * lines that have been wrapped to the start of the buffer). */      int n = 0;      for(node=oldest,prev=oldest->prev; node && node->start >= oldest->start;	  prev=node, node=node->next)	n += node->nchar;/* * Move these bytes to the end of the resized buffer. */      memmove(glh->buffer + bufsize - n, glh->buffer + oldest->start, n);/* * Adjust the buffer pointers to reflect the new locations of the moved * lines. */      shift = bufsize - n - oldest->start;      for(node=prev; node && node->start >= oldest->start; node=node->prev)	node->start += shift;    };/* * Shrink the buffer? */    if(bufsize < glh->buflen) {      char *new_buffer = (char *) realloc(glh->buffer, bufsize);      if(new_buffer)	glh->buffer = new_buffer;      glh->buflen = bufsize;  /* Mark it as shrunk, regardless of success */    };  };  return 0;}/*....................................................................... * Set an upper limit to the number of lines that can be recorded in the * history list, or remove a previously specified limit. * * Input: *  glh    GlHistory *  The input-line history maintenance object. *  max_lines    int    The maximum number of lines to allow, or -1 to *                      cancel a previous limit and allow as many lines *                      as will fit in the current history buffer size. */void _glh_limit_history(GlHistory *glh, int max_lines){  if(!glh)    return;/* * Apply a new limit? */  if(max_lines >= 0 && max_lines != glh->max_lines) {/* * Count successively older lines until we reach the start of the * list, or until we have seen max_lines lines (at which point 'node' * will be line number max_lines+1). */    int nline = 0;    GlLineNode *node;    for(node=glh->list.tail; node && ++nline <= max_lines; node=node->prev)      ;/* * Discard any lines that exceed the limit. */    if(node) {      GlLineNode *oldest = node->next;  /* The oldest line to be kept *//* * Delete nodes from the head of the list until we reach the node that * is to be kept. */      while(glh->list.head && glh->list.head != oldest)	_glh_discard_node(glh, glh->list.head);    };  };/* * Record the new limit. */  glh->max_lines = max_lines;  return;}/*....................................................................... * Discard either all history, or the history associated with the current * history group. * * Input: *  glh    GlHistory *  The input-line history maintenance object. *  all_groups   int    If true, clear all of the history. If false, *                      clear only the stored lines associated with the *                      currently selected history group. */void _glh_clear_history(GlHistory *glh, int all_groups){/* * Check the arguments. */  if(!glh)    return;/* * Cancel any ongoing search. */  (void) _glh_cancel_search(glh);/* * Delete all history lines regardless of group? */  if(all_groups) {    _rst_FreeList(glh->list.node_mem);    glh->list.head = glh->list.tail = NULL;    glh->nline = 0;    glh->id_node = NULL;/* * Just delete lines of the current group? */  } else {    GlLineNode *node;  /* The line node being checked */    GlLineNode *prev;  /* The line node that precedes 'node' */    GlLineNode *next;  /* The line node that follows 'node' *//* * Search out and delete the line nodes of the current group. */    for(node=glh->list.head; node; node=next) {/* * Keep a record of the following node before we delete the current * node. */      next = node->next;/* * Discard this node? */      if(node->group == glh->group)	_glh_discard_node(glh, node);    };/* * If there are any lines left, and we deleted any lines, there will * be gaps in the buffer. These need to be removed. */    if(glh->list.head) {      int epos;   /* The index of the last used element in the buffer *//* * Find the line nearest the end of the buffer. */      GlLineNode *enode;      for(node=glh->list.head, prev=NULL;	  node && node->start >= glh->list.head->start;	  prev=node, node = node->next)	;      enode = prev;/* * Move the end line to abutt the end of the buffer, and remove gaps * between the lines that precede it. */      epos = glh->buflen;      for(node=enode; node; node=node->prev) {	int shift = epos - (node->start + node->nchar);	if(shift) {	  memmove(glh->buffer + node->start + shift,		  glh->buffer + node->start, node->nchar);	  node->start += shift;	};	epos = node->start;      };/* * Move the first line in the buffer to the start of the buffer, and * remove gaps between the lines that follow it. */      epos = 0;      for(node=enode ? enode->next : NULL; node; node=node->next) {	int shift = epos - node->start;	if(shift) {	  memmove(glh->buffer + node->start + shift,		  glh->buffer + node->start, node->nchar);	  node->start += shift;	};	epos = node->start + node->nchar;      };    };  };  return;}/*....................................................................... * Temporarily enable or disable the history list. * * Input: *  glh    GlHistory *  The input-line history maintenance object. *  enable       int    If true, turn on the history mechanism. If *                      false, disable it. */void _glh_toggle_history(GlHistory *glh, int enable){  if(glh)    glh->enable = enable;}/*....................................................................... * Remove a given line location node from the history list, and return * it to the freelist. * * Input: *  glh    GlHistory *  The input-line history maintenance object. *  node  GlLineNode *  The node to be removed. This must be currently *                      in the list who's head is glh->list.head, or *                      be NULL. */static void _glh_discard_node(GlHistory *glh, GlLineNode *node){  if(node) {/* * Make the node that precedes the node being removed point * to the one that follows it. */    if(node->prev)      node->prev->next = node->next;    else      glh->list.head = node->next;/* * Make the node that follows the node being removed point * to the one that precedes it. */    if(node->next)      node->next->prev = node->prev;    else      glh->list.tail = node->prev;/* * If we are deleting the node that is marked as the start point of the * last ID search, remove the cached starting point. */    if(node == glh->id_node)      glh->id_node = NULL;/* * Return the node to the free list. */    node = (GlLineNode *) _del_FreeListNode(glh->list.node_mem, node);/* * Decrement the count of the number of lines in the buffer. */    glh->nline--;  };}/*....................................................................... * Lookup the details of a given history line, given its id. * * Input: *  glh      GlHistory *  The input-line history maintenance object. *  id        GlLineID    The sequential number of the line. * Input/Output: *  line    const char ** A pointer to the history line will be assigned *                        to *line. *  group     unsigned *  The group membership of the line will be assigned *                        to *group. *  timestamp   time_t *  The timestamp of the line will be assigned to *                        *timestamp. * Output: *  return         int    0 - The requested line wasn't found. *                        1 - The line was found. */int _glh_lookup_history(GlHistory *glh, GlhLineID id, const char **line,			unsigned *group, time_t *timestamp){  GlLineNode *node; /* The located line location node *//* * Check the arguments. */  if(!glh)    return 0;/* * Search for the line that has the specified ID. */  node = _glh_find_id(glh, (GlhLineID) id);/* * Not found? */  if(!node)    return 0;/* * Return the details of the line. */  if(line)    *line = glh->buffer + node->start;  if(group)    *group = node->group;  if(timestamp)    *timestamp = node->timestamp;  return 1;}/*....................................................................... * Lookup a node in the history list by its ID. * * Input: *  glh      GlHistory *  The input-line history maintenance object. *  id       GlhLineID    The ID of the line to be returned. * Output: *  return  GlLIneNode *  The located node, or NULL if not found. */static GlLineNode *_glh_find_id(GlHistory *glh, GlhLineID id){  GlLineNode *node;  /* The node being checked *//* * Is history enabled? */  if(!glh->enable || !glh->list.head)    return NULL;/* * If possible, start at the end point of the last ID search. * Otherwise start from the head of the list. */  node = glh->id_node;  if(!node)    node = glh->list.head;/* * Search forwards from 'node'? */  if(node->id < id) {    while(node && node->id != id)      node = node->next;    glh->id_node = node ? node : glh->list.tail;/* * Search backwards from 'node'? */  } else {    while(node && node->id != id)      node = node->prev;    glh->id_node = node ? node : glh->list.head;  };/* * Return the located node (this will be NULL if the ID wasn't found). */  return node;}/*....................................................................... * Query the state of the history list. Note that any of the input/output * pointers can be specified as NULL. * * Input: *  glh         GlHistory *  The input-line history maintenance object. * Input/Output: *  enabled           int *  If history is enabled, *enabled will be *                           set to 1. Otherwise it will be assigned 0. *  group        unsigned *  The current history group ID will be assigned *                           to *group. *  max_lines         int *  The currently requested limit on the number *                           of history lines in the list, or -1 if *                           unlimited. */void _glh_state_of_history(GlHistory *glh, int *enabled, unsigned *group,			   int *max_lines){  if(glh) {    if(enabled)     *enabled = glh->enable;    if(group)     *group = glh->group;    if(max_lines)     *max_lines = glh->max_lines;  };}/*....................................................................... * Get the range of lines in the history buffer. * * Input: *  glh         GlHistory *  The input-line history maintenance object. * Input/Output: *  oldest  unsigned long *  The sequential entry number of the oldest *                           line in the history list will be assigned *                           to *oldest, unless there are no lines, in *                           which case 0 will be assigned. *  newest  unsigned long *  The sequential entry number of the newest *                           line in the history list will be assigned *                           to *newest, unless there are no lines, in *                           which case 0 will be assigned. *  nlines            int *  The number of lines currently in the history *                           list. */void _glh_range_of_history(GlHistory *glh, unsigned long *oldest,			   unsigned long *newest, int *nlines){  if(glh) {    if(oldest)      *oldest = glh->list.head ? glh->list.head->id : 0;    if(newest)      *newest = glh->list.tail ? glh->list.tail->id : 0;    if(nlines)      *nlines = glh->nline;  };}/*....................................................................... * Return the size of the history buffer and the amount of the * buffer that is currently in use. * * Input: *  glh      GlHistory *  The input-line history maintenance object. * Input/Output: *  buff_size   size_t *  The size of the history buffer (bytes). *  buff_used   size_t *  The amount of the history buffer that *                        is currently occupied (bytes). */void _glh_size_of_history(GlHistory *glh, size_t *buff_size, size_t *buff_used){  if(glh) {    if(buff_size)      *buff_size = glh->buflen;/* * Determine the amount of buffer space that is currently occupied. */    if(buff_used) {      size_t used = 0;      GlLineNode *node;      for(node=glh->list.head; node; node=node->next)	used += node->nchar;      *buff_used = used;    };  };}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久精品亚洲国产奇米99| 亚洲视频一二三区| 欧美精品乱码久久久久久| 91视频一区二区| 91亚洲精品乱码久久久久久蜜桃 | 91黄色激情网站| 日韩精品自拍偷拍| 欧美浪妇xxxx高跟鞋交| 国产欧美一区二区在线观看| 6080国产精品一区二区| 高清国产一区二区| 不卡欧美aaaaa| 91精品免费在线| 极品美女销魂一区二区三区免费| 欧洲视频一区二区| 久久精品无码一区二区三区| 99久久精品免费| 午夜伦理一区二区| 国产日韩精品一区二区三区| 白白色 亚洲乱淫| 三级影片在线观看欧美日韩一区二区| 欧美一级精品在线| 91香蕉视频污| 欧美成人video| 日韩中文欧美在线| 91麻豆国产在线观看| 欧美午夜影院一区| www国产精品av| 婷婷六月综合网| 91一区二区在线观看| 亚洲天堂成人网| 欧美mv和日韩mv国产网站| 欧美性色综合网| 欧美国产一区在线| 精品国产免费一区二区三区四区 | 欧美一级二级三级蜜桃| 国产91精品露脸国语对白| 亚洲成精国产精品女| 国产精品人成在线观看免费| 欧美日韩国产在线观看| 国产精品一二一区| 婷婷国产v国产偷v亚洲高清| 国产精品成人一区二区艾草| 精品国产乱码久久久久久图片| 91极品美女在线| 国产91在线观看| 毛片av一区二区| 一区二区三区免费在线观看| 欧美国产精品专区| 日韩免费视频一区二区| 欧美日韩视频第一区| 97久久精品人人爽人人爽蜜臀| 国产一区二区主播在线| 五月天中文字幕一区二区| 国产精品国产三级国产aⅴ中文| 精品免费99久久| 欧美一二三区在线| 欧美美女一区二区在线观看| 99久久夜色精品国产网站| 国产91对白在线观看九色| 久久97超碰色| 精品系列免费在线观看| 日韩激情视频网站| 三级亚洲高清视频| 日韩影视精彩在线| 三级在线观看一区二区| 无吗不卡中文字幕| 国产精品免费视频网站| 亚洲va国产天堂va久久en| 欧美精品一区二区三区视频| 亚洲日本在线a| 欧美午夜在线一二页| 国产综合色精品一区二区三区| 91久久免费观看| 国产成人免费在线| 国产精品一区在线观看你懂的| 韩国视频一区二区| 国产综合色产在线精品| 国产精品亚洲人在线观看| 国产精品影视在线| 国产精品主播直播| 成人爽a毛片一区二区免费| 国产福利不卡视频| 不卡在线观看av| 91小视频免费观看| 欧美性极品少妇| 欧美欧美午夜aⅴ在线观看| 欧美日韩大陆在线| 日韩写真欧美这视频| 欧美xxxx老人做受| 久久久综合精品| 国产精品婷婷午夜在线观看| 亚洲欧洲成人av每日更新| 亚洲免费在线视频| 日本女优在线视频一区二区| 黄色日韩三级电影| 99在线精品免费| 欧美三级三级三级| 精品电影一区二区| 国产精品久久毛片av大全日韩| 亚洲欧美一区二区久久 | 国产日产欧美一区二区视频| 国产精品久久一级| 亚洲福利一区二区三区| 麻豆91精品视频| 成+人+亚洲+综合天堂| 欧日韩精品视频| 精品国产一区二区精华| 国产精品乱码妇女bbbb| 亚洲国产美国国产综合一区二区| 久久99精品国产.久久久久久| www.成人网.com| 欧美高清性hdvideosex| 国产精品沙发午睡系列990531| 亚洲欧美欧美一区二区三区| 久久成人免费日本黄色| 91在线观看一区二区| 欧美一级搡bbbb搡bbbb| 中文字幕免费在线观看视频一区| 午夜精品在线看| 成人免费视频播放| 日韩午夜在线观看| 亚洲免费观看高清在线观看| 欧美视频第二页| 国产日韩成人精品| 美女任你摸久久 | 亚洲一二三专区| 国产福利91精品一区| 欧美乱妇23p| 亚洲欧美偷拍卡通变态| 韩国v欧美v日本v亚洲v| 欧美在线视频日韩| 国产精品免费网站在线观看| 美女视频一区二区| 在线国产电影不卡| 国产精品短视频| 国产一区二区三区电影在线观看 | 91视频免费播放| 国产日韩欧美精品电影三级在线| 日本欧美一区二区| 91精品91久久久中77777| 国产精品毛片高清在线完整版| 蜜桃91丨九色丨蝌蚪91桃色| 91福利区一区二区三区| 中文字幕中文字幕中文字幕亚洲无线| 蜜桃久久久久久| 欧美男女性生活在线直播观看| 亚洲欧洲99久久| 国产福利电影一区二区三区| 欧美变态凌虐bdsm| 蜜臀av一区二区在线观看| 欧美精品亚洲一区二区在线播放| 亚洲欧洲av在线| 91丨porny丨中文| 国产精品久久久久久久久动漫| 国产精品影视网| 久久久无码精品亚洲日韩按摩| 日韩二区三区在线观看| 欧美吻胸吃奶大尺度电影| 亚洲精品精品亚洲| jizz一区二区| 中文字幕一区在线| 波多野结衣91| 中文字幕一区二区视频| av一区二区三区四区| 国产精品美女久久久久久久网站| 国产精品亚洲第一区在线暖暖韩国| 26uuu精品一区二区| 国产乱码精品一区二区三区忘忧草 | 欧美日韩高清在线| 五月天中文字幕一区二区| 欧美人伦禁忌dvd放荡欲情| 无码av中文一区二区三区桃花岛| 欧美猛男gaygay网站| 日韩av电影免费观看高清完整版| 制服丝袜中文字幕一区| 久久99精品国产| 国产午夜精品久久久久久免费视| 国产v综合v亚洲欧| 中文字幕亚洲一区二区av在线 | 91精品国产综合久久国产大片| 日韩电影在线看| 日韩一区二区三区免费看| 精品一区二区三区日韩| 国产欧美精品国产国产专区| 99久久伊人精品| 亚洲第一二三四区| 欧美一区二区三区色| 国产在线视频一区二区| 18成人在线观看| 欧美日韩免费视频| 精久久久久久久久久久| 国产欧美日韩另类一区| 色综合天天综合| 日韩成人精品在线| 亚洲国产精品av| 欧美性大战久久久久久久蜜臀| 日本色综合中文字幕| 亚洲国产精品av| 欧美喷水一区二区|