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

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

?? keytab.c

?? BCAST Implementation for NS2
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * Copyright (c) 2000, 2001 by Martin C. Shepherd. *  * All rights reserved. *  * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, and/or sell copies of the Software, and to permit persons * to whom the Software is furnished to do so, provided that the above * copyright notice(s) and this permission notice appear in all copies of * the Software and that both the above copyright notice(s) and this * permission notice appear in supporting documentation. *  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT * OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR * HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL * INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING * FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *  * Except as contained in this notice, the name of a copyright holder * shall not be used in advertising or otherwise to promote the sale, use * or other dealings in this Software without prior written authorization * of the copyright holder. */#include <stdio.h>#include <stdlib.h>#include <string.h>#include <ctype.h>#include "keytab.h"#include "getline.h"#include "strngmem.h"static int _kt_extend_table(KeyTab *kt);#if 0static int _kt_parse_keybinding_string(const char *keyseq,				       char *binary, int *nc);#endifstatic int _kt_compare_strings(const char *s1, int n1, const char *s2, int n2);static void _kt_assign_action(KeySym *sym, KtBinder binder, KtKeyFn *keyfn);static char _kt_backslash_escape(const char *string, const char **endp);static int _kt_is_emacs_meta(const char *string);static int _kt_is_emacs_ctrl(const char *string);/*....................................................................... * Create a new key-binding symbol table. * * Output: *  return  KeyTab *  The new object, or NULL on error. */KeyTab *_new_KeyTab(void){  KeyTab *kt;  /* The object to be returned *//* * Allocate the container. */  kt = (KeyTab *) malloc(sizeof(KeyTab));  if(!kt) {    fprintf(stderr, "new_KeyTab: Insufficient memory.\n");    return NULL;  };/* * Before attempting any operation that might fail, initialize the * container at least up to the point at which it can safely be passed * to del_KeyTab(). */  kt->size = KT_TABLE_INC;  kt->nkey = 0;  kt->table = NULL;  kt->actions = NULL;  kt->smem = NULL;/* * Allocate the table. */  kt->table = (KeySym *) malloc(sizeof(kt->table[0]) * kt->size);  if(!kt->table) {    fprintf(stderr, "new_KeyTab: Insufficient memory for table of size %d.\n",	    kt->size);    return _del_KeyTab(kt);  };/* * Allocate a hash table of actions. */  kt->actions = _new_HashTable(NULL, KT_HASH_SIZE, IGNORE_CASE, NULL, 0);  if(!kt->actions)    return _del_KeyTab(kt);/* * Allocate a string allocation object. This allows allocation of * small strings without fragmenting the heap. */  kt->smem = _new_StringMem("new_KeyTab", KT_TABLE_INC);  if(!kt->smem)    return _del_KeyTab(kt);  return kt;}/*....................................................................... * Delete a KeyTab object. * * Input: *  kt   KeyTab *  The object to be deleted. * Output: *  return KeyTab *  The deleted object (always NULL). */KeyTab *_del_KeyTab(KeyTab *kt){  if(kt) {    if(kt->table)      free(kt->table);    kt->actions = _del_HashTable(kt->actions);    kt->smem = _del_StringMem("del_KeyTab", kt->smem, 1);    free(kt);  };  return NULL;}/*....................................................................... * Increase the size of the table to accomodate more keys. * * Input: *  kt       KeyTab *  The table to be extended. * Output: *  return      int    0 - OK. *                     1 - Error. */static int _kt_extend_table(KeyTab *kt){/* * Attempt to increase the size of the table. */  KeySym *newtab = (KeySym *) realloc(kt->table, sizeof(kt->table[0]) *				      (kt->size + KT_TABLE_INC));/* * Failed? */  if(!newtab) {    fprintf(stderr,	    "getline(): Insufficient memory to extend keybinding table.\n");    return 1;  };/* * Install the resized table. */  kt->table = newtab;  kt->size += KT_TABLE_INC;  return 0;}/*....................................................................... * Add, update or remove a keybinding to the table. * * Input: *  kt           KeyTab *  The table to add the binding to. *  binder     KtBinder    The source of the binding. *  keyseq   const char *  The key-sequence to bind. *  action         char *  The action to associate with the key sequence, or *                         NULL to remove the action associated with the *                         key sequence. * Output: *  return          int    0 - OK. *                         1 - Error. */int _kt_set_keybinding(KeyTab *kt, KtBinder binder, const char *keyseq,		       const char *action){  KtKeyFn *keyfn; /* The action function *//* * Check arguments. */  if(kt==NULL || !keyseq) {    fprintf(stderr, "kt_set_keybinding: NULL argument(s).\n");    return 1;  };/* * Lookup the function that implements the specified action. */  if(!action) {    keyfn = 0;  } else {    Symbol *sym = _find_HashSymbol(kt->actions, action);    if(!sym) {      fprintf(stderr, "getline: Unknown key-binding action: %s\n", action);      return 1;    };    keyfn = (KtKeyFn *) sym->fn;  };/* * Record the action in the table. */  return _kt_set_keyfn(kt, binder, keyseq, keyfn);}/*....................................................................... * Add, update or remove a keybinding to the table, specifying an action * function directly. * * Input: *  kt       KeyTab *  The table to add the binding to. *  binder KtBinder    The source of the binding. *  keyseq     char *  The key-sequence to bind. *  keyfn   KtKeyFn *  The action function, or NULL to remove any existing *                     action function. * Output: *  return     int    0 - OK. *                    1 - Error. */int _kt_set_keyfn(KeyTab *kt, KtBinder binder, const char *keyseq,		  KtKeyFn *keyfn){  const char *kptr;  /* A pointer into keyseq[] */  char *binary;      /* The binary version of keyseq[] */  int nc;            /* The number of characters in binary[] */  int first,last;    /* The first and last entries in the table which */                     /*  minimally match. */  int size;          /* The size to allocate for the binary string *//* * Check arguments. */  if(kt==NULL || !keyseq) {    fprintf(stderr, "kt_set_keybinding: NULL argument(s).\n");    return 1;  };/* * Work out a pessimistic estimate of how much space will be needed * for the binary copy of the string, noting that binary meta characters * embedded in the input string get split into two characters. */  for(size=0,kptr = keyseq; *kptr; kptr++)    size += IS_META_CHAR(*kptr) ? 2 : 1;/* * Allocate a string that has the length of keyseq[]. */  binary = _new_StringMemString(kt->smem, size + 1);  if(!binary) {    fprintf(stderr,	    "gl_get_line: Insufficient memory to record key sequence.\n");    return 1;  };/* * Convert control and octal character specifications to binary characters. */  if(_kt_parse_keybinding_string(keyseq, binary, &nc)) {    binary = _del_StringMemString(kt->smem, binary);    return 1;  };/* * Lookup the position in the table at which to insert the binding. */  switch(_kt_lookup_keybinding(kt, binary, nc, &first, &last)) {/* * If an exact match for the key-sequence is already in the table, * simply replace its binding function (or delete the entry if * the new binding is 0). */  case KT_EXACT_MATCH:    if(keyfn) {      _kt_assign_action(kt->table + first, binder, keyfn);    } else {      _del_StringMemString(kt->smem, kt->table[first].keyseq);      memmove(kt->table + first, kt->table + first + 1,	      (kt->nkey - first - 1) * sizeof(kt->table[0]));      kt->nkey--;    };    binary = _del_StringMemString(kt->smem, binary);    break;/* * If an ambiguous match has been found and we are installing a * callback, then our new key-sequence would hide all of the ambiguous * matches, so we shouldn't allow it. */  case KT_AMBIG_MATCH:    if(keyfn) {      fprintf(stderr,	      "getline: Can't bind \"%s\", because it's a prefix of another binding.\n",	      keyseq);      binary = _del_StringMemString(kt->smem, binary);      return 1;    };    break;/* * If the entry doesn't exist, create it. */  case KT_NO_MATCH:/* * Add a new binding? */    if(keyfn) {      KeySym *sym;/* * We will need a new entry, extend the table if needed. */      if(kt->nkey + 1 > kt->size) {	if(_kt_extend_table(kt)) {	  binary = _del_StringMemString(kt->smem, binary);	  return 1;	};      };/* * Make space to insert the new key-sequence before 'last'. */      if(last < kt->nkey) {	memmove(kt->table + last + 1, kt->table + last,		(kt->nkey - last) * sizeof(kt->table[0]));      };/* * Insert the new binding in the vacated position. */      sym = kt->table + last;      sym->keyseq = binary;      sym->nc = nc;      sym->user_fn = sym->term_fn = sym->norm_fn = sym->keyfn = 0;      _kt_assign_action(sym, binder, keyfn);      kt->nkey++;    };    break;  case KT_BAD_MATCH:    binary = _del_StringMemString(kt->smem, binary);    return 1;    break;  };  return 0;}/*....................................................................... * Perform a min-match lookup of a key-binding. * * Input: *  kt          KeyTab *  The keybinding table to lookup in. *  binary_keyseq char *  The binary key-sequence to lookup. *  nc             int    the number of characters in keyseq[]. * Input/Output: *  first,last     int *  If there is an ambiguous or exact match, the indexes *                        of the first and last symbols that minimally match *                        will be assigned to *first and *last respectively. *                        If there is no match, then first and last will *                        bracket the location where the symbol should be *                        inserted. *                       * Output: *  return  KtKeyMatch    One of the following enumerators: *                         KT_EXACT_MATCH - An exact match was found. *                         KT_AMBIG_MATCH - An ambiguous match was found. *                         KT_NO_MATCH    - No match was found. *                         KT_BAD_MATCH   - An error occurred while searching. */KtKeyMatch _kt_lookup_keybinding(KeyTab *kt, const char *binary_keyseq, int nc,				 int *first, int *last){  int mid;     /* The index at which to bisect the table */  int bot;     /* The lowest index of the table not searched yet */  int top;     /* The highest index of the table not searched yet */  int test;    /* The return value of strcmp() *//* * Check the arguments. */  if(!kt || !binary_keyseq || !first || !last || nc < 0) {    fprintf(stderr, "kt_lookup_keybinding: NULL argument(s).\n");    return KT_BAD_MATCH;  };/* * Perform a binary search for the key-sequence. */  bot = 0;  top = kt->nkey - 1;  while(top >= bot) {    mid = (top + bot)/2;    test = _kt_compare_strings(kt->table[mid].keyseq, kt->table[mid].nc,			   binary_keyseq, nc);    if(test > 0)      top = mid - 1;    else if(test < 0)      bot = mid + 1;    else {      *first = *last = mid;      return KT_EXACT_MATCH;    };  };/* * An exact match wasn't found, but top is the index just below the * index where a match would be found, and bot is the index just above * where the match ought to be found. */  *first = top;  *last = bot;/* * See if any ambiguous matches exist, and if so make *first and *last * refer to the first and last matches. */  if(*last < kt->nkey && kt->table[*last].nc > nc &&     _kt_compare_strings(kt->table[*last].keyseq, nc, binary_keyseq, nc)==0) {    *first = *last;    while(*last+1 < kt->nkey && kt->table[*last+1].nc > nc &&	  _kt_compare_strings(kt->table[*last+1].keyseq, nc, binary_keyseq, nc)==0)      (*last)++;    return KT_AMBIG_MATCH;  };/* * No match. */  return KT_NO_MATCH;}/*....................................................................... * Convert a keybinding string into a uniq binary representation. * * Control characters can be given directly in their binary form, * expressed as either ^ or C-, followed by the character, expressed in * octal, like \129 or via C-style backslash escapes, with the addition

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色狠狠色噜噜噜综合网| 国产精品三级av| 欧美激情在线看| 亚洲一区二区五区| 国产成人一区在线| 欧美日韩一区二区三区在线| 国产欧美日韩一区二区三区在线观看| 亚洲成人第一页| 91免费视频网| 国产欧美在线观看一区| 三级在线观看一区二区| 91免费版pro下载短视频| 精品国产一二三| 日韩精品免费视频人成| 97精品国产露脸对白| 久久精品在线免费观看| 强制捆绑调教一区二区| 欧美午夜理伦三级在线观看| 成人欧美一区二区三区黑人麻豆 | 日韩av中文字幕一区二区| 成人国产一区二区三区精品| 久久综合久久综合久久综合| 丝袜美腿亚洲综合| 欧美男人的天堂一二区| 亚洲另类一区二区| 99国产精品久| 亚洲精品日韩专区silk| av一区二区三区| 亚洲色图清纯唯美| av资源网一区| 亚洲手机成人高清视频| av爱爱亚洲一区| 亚洲日本va在线观看| 成人高清视频在线| 中日韩免费视频中文字幕| 国产成人精品亚洲日本在线桃色 | 91精品国产综合久久香蕉的特点| 亚洲一区二区欧美日韩| 欧美制服丝袜第一页| 一区二区三区中文字幕| 欧美亚洲愉拍一区二区| 亚洲综合色网站| 欧美精品第一页| 日韩高清不卡在线| 欧美大度的电影原声| 国产一区二区三区综合| 国产亚洲午夜高清国产拍精品| 国产成人亚洲综合a∨婷婷图片| 欧美激情在线看| 色悠悠久久综合| 亚洲成av人片观看| 日韩丝袜美女视频| 国产毛片精品国产一区二区三区| 国产精品欧美一区喷水| 91久久香蕉国产日韩欧美9色| 亚洲福利一区二区| 日韩欧美一区二区在线视频| 国产做a爰片久久毛片 | 日韩欧美一区二区视频| 国产一区高清在线| 亚洲视频一区二区免费在线观看| 色老汉一区二区三区| 日本在线观看不卡视频| 国产精品视频在线看| 色呦呦网站一区| 久久69国产一区二区蜜臀| 欧美国产日韩一二三区| 欧美亚洲国产一区二区三区va| 美女精品自拍一二三四| 日韩一区日韩二区| 日韩精品专区在线影院重磅| 成人免费毛片片v| 日本不卡一区二区三区 | 日韩欧美激情在线| aaa国产一区| 毛片基地黄久久久久久天堂| 自拍偷拍国产精品| 日韩欧美一二三区| 91久久线看在观草草青青| 久久99国产精品麻豆| 一区二区三区日韩欧美| 久久久午夜精品理论片中文字幕| 色综合激情五月| 国产成人综合自拍| 亚洲.国产.中文慕字在线| 国产精品三级视频| 欧美电影免费观看完整版 | 风间由美一区二区三区在线观看 | 国产日韩欧美高清| 欧美精品tushy高清| 91丨porny丨国产入口| 国产在线不卡一区| 奇米精品一区二区三区在线观看一 | 欧美视频在线不卡| av电影在线不卡| 国产成人精品午夜视频免费| 日韩电影网1区2区| 亚洲图片欧美视频| 亚洲天堂免费看| 国产精品网曝门| 亚洲国产精品激情在线观看| 亚洲精品在线电影| 日韩欧美国产午夜精品| 欧美久久久久久蜜桃| 欧美日韩精品免费观看视频| 99re这里只有精品视频首页| 国内一区二区在线| 免费国产亚洲视频| 亚洲精品视频在线看| 欧美精品亚洲一区二区在线播放| 成人av在线网站| 国产福利一区在线观看| 美女一区二区视频| 亚洲成人你懂的| 亚洲国产精品一区二区久久恐怖片 | 欧美精品久久久久久久久老牛影院| 97精品国产露脸对白| 国产福利一区二区三区在线视频| 青娱乐精品视频| 视频一区欧美精品| 亚洲成在线观看| 久久精品人人做| 欧美激情综合五月色丁香| 精品国产露脸精彩对白| 日韩一区二区三区免费看| 欧美日韩成人一区二区| 欧美日韩国产在线观看| 在线电影国产精品| 欧美日韩你懂得| 欧美性生活一区| 欧美在线综合视频| 91极品视觉盛宴| 欧美一区二区视频在线观看2020 | 欧美日韩一区二区三区免费看| 日本韩国欧美一区二区三区| 欧美日韩你懂得| 欧美电影在线免费观看| 欧美群妇大交群的观看方式| 欧美日韩在线观看一区二区| 欧美视频三区在线播放| 在线一区二区三区| 在线中文字幕一区二区| 欧美日韩一区国产| 欧美一级生活片| 日韩欧美aaaaaa| 日韩精品最新网址| 欧美国产禁国产网站cc| 欧美国产一区视频在线观看| 国产精品免费久久久久| 亚洲日本韩国一区| 久久 天天综合| 风间由美一区二区三区在线观看| caoporn国产一区二区| 色婷婷av一区二区| 欧美性一级生活| 久久久综合激的五月天| 亚洲欧美国产高清| 天天影视色香欲综合网老头| 日本午夜精品一区二区三区电影| 国产精品538一区二区在线| av在线不卡免费看| 欧美男男青年gay1069videost| 在线观看国产精品网站| 欧美另类高清zo欧美| 精品国产不卡一区二区三区| 久久久精品国产免大香伊| 亚洲另类春色校园小说| 国产成人a级片| 欧美视频三区在线播放| 日韩美女视频在线| 中文字幕亚洲一区二区va在线| 夜夜夜精品看看| 国产+成+人+亚洲欧洲自线| 欧美在线999| 久久久久久久久久看片| 亚洲午夜久久久久中文字幕久| 成人综合在线网站| 欧美日韩国产美女| 欧美极品aⅴ影院| 日韩电影在线观看电影| 成人综合在线视频| 日韩欧美黄色影院| 亚洲伦在线观看| 久久精品国产第一区二区三区| 91在线丨porny丨国产| 精品福利av导航| 婷婷中文字幕一区三区| av在线不卡电影| 日韩三级伦理片妻子的秘密按摩| 亚洲精品久久久久久国产精华液| 国产一区二区精品在线观看| 欧美色视频在线观看| 欧美国产一区二区在线观看| 国产不卡视频在线观看| 欧美一区二区国产| 一区二区三区欧美激情| 国产在线日韩欧美| 久久综合色播五月| 日本人妖一区二区| 欧美精品九九99久久|