EE_DSnP 板


LINE

事由: ===== 1. 昨天上传的 sample code (charDef.h and charDef.cpp) 有问题.... (OS: 果然没有做"验证"是不行的... XD) 2. 好像只有我用 SecureCRT 的 keyboard mapping 跟大家不一样... 助教的 mapping 跟大家一样也是 (tested on different machines) --- Back space 127 Delete 27 91 51 126 所以我将 charDef.h and charDef.cpp 作了修正, 现在 by default 将会是上述的 setting. 请注意: 不管你的 setting 是否跟助教的一样, 请重新 download "charDef.h", "charDef.cpp" 以及 Makefile. 这样助教才能用 default 的设定来测试你的程式. 当然, 如果你的 setting 跟助教一样, 你在 download 下来後可以不用更改上述三个 档案, 使用 default 的设定值就可以了. 但是如果你的设定值跟助教的不一样, 请参照 post 85 等讨论串 在 "#ifdef MY_KB_SETTING" 间加入你的版本的 code. 造成不便, 敬请见谅... Homework deadline 仍然不变... 附上新改的 charDef.h and charDef.cpp --- charDef.h ========= #ifdef MY_KB_SETTING // Customize your setting here... #else enum ParseChar { // Meta type FUNC_BASE_SHIFT = 1 << 8, // shifted 8 bits (char size) ARROW_BASE_SHIFT = 1 << 9, DELETE_BASE_SHIFT= 1 << 10, UNDEFINED_CHAR = INT_MAX, // char #1 LINE_BEGIN_CHAR = 1, // ctrl-a LINE_END_CHAR = 5, // ctrl-e INPUT_END_CHAR = 4, // ctrl-d BEEP_CHAR = 7, BACK_SPACE_CHAR = 8, BACK_SPACE_KEY = 127, ESC_CHAR = 27, DELETE_CHAR = 126 + DELETE_BASE_SHIFT, TAB_CHAR = int('\t'), NEWLINE_CHAR = int('\n'), // char #2 FUNC_BASE_CHAR = 79, ARROW_BASE_CHAR = 91, // char #3 FUNC_F1_CHAR = 80 + FUNC_BASE_SHIFT, FUNC_F2_CHAR = 81 + FUNC_BASE_SHIFT, FUNC_F3_CHAR = 82 + FUNC_BASE_SHIFT, FUNC_F4_CHAR = 83 + FUNC_BASE_SHIFT, ARROW_UP_CHAR = 65 + ARROW_BASE_SHIFT, ARROW_DOWN_CHAR = 66 + ARROW_BASE_SHIFT, ARROW_RIGHT_CHAR = 67 + ARROW_BASE_SHIFT, ARROW_LEFT_CHAR = 68 + ARROW_BASE_SHIFT, DELETE_BASE_CHAR = 51, // dummy end PARSE_CHAR_END }; #endif // MY_KB_SETTING charDef.cpp =========== #ifdef MY_KB_SETTING // Modify for your terminal setting accordingly #else // Here's a sample for DELETE = ( 27 91 51 126 ) // BACKSPACE = 127 ParseChar CmdParser::getChar(istream& istr) const { char ch = mygetc(istr); if (istr.eof()) return INPUT_END_CHAR; switch (ch) { case LINE_BEGIN_CHAR: case LINE_END_CHAR: case INPUT_END_CHAR: // case DELETE_CHAR: case TAB_CHAR: case NEWLINE_CHAR: return ParseChar(ch); case BACK_SPACE_KEY: return BACK_SPACE_CHAR; case ESC_CHAR: { char ch2 = mygetc(istr); if (ch2 == char(FUNC_BASE_CHAR)) { char ch3 = mygetc(istr); if ((ch3 >= char(FUNC_F1_CHAR)) && (ch3 <= char(FUNC_F4_CHAR))) return ParseChar(int(ch3) + FUNC_BASE_SHIFT); else return UNDEFINED_CHAR; } else if (ch2 == char(ARROW_BASE_CHAR)) { char ch3 = mygetc(istr); if ((ch3 >= char(ARROW_UP_CHAR))&&(ch3 <= char(ARROW_LEFT_CHAR))) return ParseChar(int(ch3) + ARROW_BASE_SHIFT); else if (ch3 == char(DELETE_BASE_CHAR)) { if (mygetc(istr) == char(DELETE_CHAR)) return ParseChar(DELETE_CHAR); } else return UNDEFINED_CHAR; } // else continue for "default" } default: if (isprint(ch)) return ParseChar(ch); else return UNDEFINED_CHAR; } return UNDEFINED_CHAR; } #endif // MY_KB_SETTING --------- 以上的 code 已经测过, 应该没问题啦~~~ --



※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.21.240 ※ 编辑: ric2k1 来自: 140.112.21.240 (10/25 17:51)
1F:→ ric2k1:助教的提醒, 在 6pm 10/25 又上传了一次... 10/25 18:06







like.gif 您可能会有兴趣的文章
icon.png[问题/行为] 猫晚上进房间会不会有憋尿问题
icon.pngRe: [闲聊] 选了错误的女孩成为魔法少女 XDDDDDDDDDD
icon.png[正妹] 瑞典 一张
icon.png[心得] EMS高领长版毛衣.墨小楼MC1002
icon.png[分享] 丹龙隔热纸GE55+33+22
icon.png[问题] 清洗洗衣机
icon.png[寻物] 窗台下的空间
icon.png[闲聊] 双极の女神1 木魔爵
icon.png[售车] 新竹 1997 march 1297cc 白色 四门
icon.png[讨论] 能从照片感受到摄影者心情吗
icon.png[狂贺] 贺贺贺贺 贺!岛村卯月!总选举NO.1
icon.png[难过] 羡慕白皮肤的女生
icon.png阅读文章
icon.png[黑特]
icon.png[问题] SBK S1安装於安全帽位置
icon.png[分享] 旧woo100绝版开箱!!
icon.pngRe: [无言] 关於小包卫生纸
icon.png[开箱] E5-2683V3 RX480Strix 快睿C1 简单测试
icon.png[心得] 苍の海贼龙 地狱 执行者16PT
icon.png[售车] 1999年Virage iO 1.8EXi
icon.png[心得] 挑战33 LV10 狮子座pt solo
icon.png[闲聊] 手把手教你不被桶之新手主购教学
icon.png[分享] Civic Type R 量产版官方照无预警流出
icon.png[售车] Golf 4 2.0 银色 自排
icon.png[出售] Graco提篮汽座(有底座)2000元诚可议
icon.png[问题] 请问补牙材质掉了还能再补吗?(台中半年内
icon.png[问题] 44th 单曲 生写竟然都给重复的啊啊!
icon.png[心得] 华南红卡/icash 核卡
icon.png[问题] 拔牙矫正这样正常吗
icon.png[赠送] 老莫高业 初业 102年版
icon.png[情报] 三大行动支付 本季掀战火
icon.png[宝宝] 博客来Amos水蜡笔5/1特价五折
icon.pngRe: [心得] 新鲜人一些面试分享
icon.png[心得] 苍の海贼龙 地狱 麒麟25PT
icon.pngRe: [闲聊] (君の名は。雷慎入) 君名二创漫画翻译
icon.pngRe: [闲聊] OGN中场影片:失踪人口局 (英文字幕)
icon.png[问题] 台湾大哥大4G讯号差
icon.png[出售] [全国]全新千寻侘草LED灯, 水草

请输入看板名称,例如:Boy-Girl站内搜寻

TOP