精華區beta EE_DSnP 關於我們 聯絡資訊
有許多的同學反映在不同的 terminal 上 keyboard 的 setting 不同, 所以造成 每個人的 "ParseChar CmdParser::getChar(istream& istr) const" 也有所不同, 到時候我們在改作業時勢必會造成困擾. 因此, 在此我對 reference code "hw2.tgz" 稍作修正 --- 1. Create a new file "charDef.cpp", move the functions "static void reset_keypress(void)", "static void set_keypress(void)", "static char mygetc(istream& istr)", "ParseChar CmdParser::getChar(istream& istr) const" from "cmdParser.cpp" to this file. 2. Use a compilation flag "MY_KB_SETTING" --- In file "charDef.cpp" --- ========================== #ifdef MY_KB_SETTING // Modify for your terminal setting according #else ParseChar CmdParser::getChar(istream& istr) const { ...... } #endif // MY_KB_SETTING In file "charDef.h" --- ======================= #ifdef MY_KB_SETTING // Customize your setting here... #else enum ParseChar { ...... }; #endif // MY_KB_SETTING In other words, modify these two parts accordingly based on your terminal and shell setting. 3. In "Makefile", in addition to the new "charDef.o" entry, I create a new MACRO: #CFLAGS = -g -Wall -DMY_KB_SETTING CFLAGS = -g -Wall You can exchange the comment "#" and thus it will compile your modified codes. 4. When TA tests your program, he will undefine the "MY_KB_SETTING" flag and thus use the default (reference code) setting on our environment. Please download the reference code "hw2.tgz" for these changes. Sorry for the inconvenience. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.121.132.120
ric2k1:聽說已經有人寫完了... 是不是出得太簡單了... XD 10/22 01:25
Parhelia:那兩個人不正常 XD 10/22 01:42