• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン326 (tree)
日時2012-07-19 20:04:48
作者hikarupsp

ログメッセージ

コンソールでコマンドが実行できるようになった。memコマンドとtestコマンド。
カーソルの点滅も実装した。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/console.c (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/console.c (revision 326)
@@ -80,6 +80,8 @@
8080 {
8181 UI_Task *mytask;
8282 uint data;
83+ UI_Timer *ctimer;
84+ bool key_ignore;
8385
8486 data = 0;
8587
@@ -89,6 +91,8 @@
8991 debug("CMT:ConsoleMainTask[UI_Task=0x%X] Start Running.\n", mytask);
9092 #endif
9193
94+ myconsole->printf_buffer = (uchar *)System_Memory_Allocate(CONSOLE_PRINTF_BUFFER_SIZE);
95+
9296 TextBox_Show(myconsole->textbox, SHEET_MAX_CHILDREN, (int)(myconsole->textbox->sheet->parent->size.x >> 1) - (int)(myconsole->textbox->sheet->size.x >> 1), (int)(myconsole->textbox->sheet->parent->size.y >> 1) - (int)(myconsole->textbox->sheet->size.y >> 1));
9397 if(myconsole->textbox->sheet->location.x < 0){
9498 Sheet_Slide_Absolute(myconsole->textbox->sheet, 0, SHEET_LOCATION_NOCHANGE);
@@ -100,6 +104,10 @@
100104 TextBox_SetEnable_RecordInputText(myconsole->textbox, True);
101105 myconsole->flags.bit.isprompt = True;
102106
107+ ctimer = Timer_Initialize();
108+ Timer_Config(ctimer, 500, mytask->fifo, 1, True);
109+ Timer_Run(ctimer);
110+
103111 for(;;){
104112 if(FIFO32_MyTaskFIFO_Status() == 0){
105113 System_MultiTask_Task_Sleep(mytask);
@@ -110,12 +118,43 @@
110118 #endif
111119 if(data < INPUTSIGNAL_OFFSET){
112120 //汎用利用可能領域0
121+ if(data == 1){
122+ TextBox_Cursor_Blink(myconsole->textbox);
123+ }
113124 } else if(data < SIGNAL_KEY_OFFSET){
125+ data -= INPUTSIGNAL_OFFSET;
126+ if(data == INPUTSIGNAL_FOCUS_GOT){
127+ TextBox_SetEnable_CursorBlink(myconsole->textbox, True);
128+ } else if(data == INPUTSIGNAL_FOCUS_LOST){
129+ TextBox_SetEnable_CursorBlink(myconsole->textbox, False);
130+ }
114131 //入力通知領域
115132 } else if(data < SIGNAL_KEY_OFFSET + 0xffff){
133+ key_ignore = False;
116134 //keyid通知
117135 data -= SIGNAL_KEY_OFFSET;
118- TextBox_Put_Character(myconsole->textbox, data);
136+ if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){
137+ if((data & KEYID_MASK_ID) == KEYID_ENTER){
138+ key_ignore = True;
139+ TextBox_SetEnable_RecordInputText(myconsole->textbox, False);
140+ TextBox_Put_Character(myconsole->textbox, '\n');
141+ if(Console_CompareCommandline_s(myconsole, "test")){
142+ TextBox_Put_String(myconsole->textbox, "Hello, World.");
143+ } else if(Console_CompareCommandline_s(myconsole, "mem")){
144+ Console_printf(myconsole, "Total:%10uBytes %5uKB\n", System_Get_PhisycalMemorySize(), System_Get_PhisycalMemorySize() >> 10);
145+ Console_printf(myconsole, "Free :%10uBytes %5uKB\n", System_Memory_Get_FreeSize(), System_Memory_Get_FreeSize() >> 10);
146+ } else{
147+ TextBox_Put_String(myconsole->textbox, "Console:No such file or command:");
148+ TextBox_Put_String(myconsole->textbox, myconsole->textbox->text_buf);
149+ }
150+ TextBox_Put_Character(myconsole->textbox, '\n');
151+ TextBox_Put_Character(myconsole->textbox, '>');
152+ TextBox_SetEnable_RecordInputText(myconsole->textbox, True);
153+ }
154+ }
155+ if(!key_ignore){
156+ TextBox_Put_Key(myconsole->textbox, data);
157+ }
119158 } else if(data < TCM_OFFSET){
120159 //汎用利用可能領域1
121160 } else{
@@ -124,3 +163,16 @@
124163 }
125164 }
126165 }
166+
167+bool Console_CompareCommandline_s(UI_Console *myconsole, const uchar s[])
168+{
169+ return CFunction_CompareStrings(myconsole->textbox->text_buf, s);
170+}
171+
172+uint Console_printf(UI_Console *myconsole, const uchar format[], ...)
173+{
174+ CFunction_vsnprintf(myconsole->printf_buffer, CONSOLE_PRINTF_BUFFER_SIZE, format, (uint *)(&format + 1));
175+ TextBox_Put_String(myconsole->textbox, myconsole->printf_buffer);
176+ return 0;
177+}
178+
--- beta/tolset_chn_000/chnos_010/chnos/system.c (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/system.c (revision 326)
@@ -461,9 +461,11 @@
461461
462462 uint System_InputFocus_Change(DATA_FIFO32 *fifo)
463463 {
464- FIFO32_Put(System.InputFocus, INPUTSIGNAL_FOCUS_LOST);
465- System.InputFocus = fifo;
466- FIFO32_Put(System.InputFocus, INPUTSIGNAL_FOCUS_GOT);
464+ if(System.InputFocus != fifo){
465+ FIFO32_Put(System.InputFocus, INPUTSIGNAL_OFFSET + INPUTSIGNAL_FOCUS_LOST);
466+ System.InputFocus = fifo;
467+ FIFO32_Put(System.InputFocus, INPUTSIGNAL_OFFSET + INPUTSIGNAL_FOCUS_GOT);
468+ }
467469 return 0;
468470 }
469471
--- beta/tolset_chn_000/chnos_010/chnos/textbox.c (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/textbox.c (revision 326)
@@ -8,8 +8,8 @@
88 textbox = (UI_TextBox *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_TEXTBOX);
99 textbox->flags.bit.initialized = True;
1010
11- textbox->forecol = 0x000000;
12- textbox->backcol = 0xffffff;
11+ textbox->forecol = 0xffffff;
12+ textbox->backcol = 0xc6c6c6;
1313
1414 return textbox;
1515 }
@@ -71,21 +71,18 @@
7171 //charを渡すことも可能。
7272 //Break時のキーコードは無視して何も入力しない(keyidを直接渡すだけで入力ができるようにするため)。
7373 //タブ文字は、記録がオフの時のみ入力可能。
74-uint TextBox_Put_Character(UI_TextBox *textbox, ushort keyid)
74+uint TextBox_Put_Key(UI_TextBox *textbox, ushort keyid)
7575 {
76- uchar s[2];
77- uint i;
78-
7976 if(textbox == Null){
8077 #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
81- debug("TextBox_Put_Character:Null textbox.\n");
78+ debug("TextBox_Put_Key:Null textbox.\n");
8279 #endif
8380 return 1;
8481 }
8582
86- if(textbox->sheet == Null){
83+ if(!textbox->flags.bit.textbuffer_configured){
8784 #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
88- debug("TextBox_Put_Character:Null textbox sheet.\n");
85+ debug("TextBox_Put_Key:Buffer not configured.\n");
8986 #endif
9087 return 2;
9188 }
@@ -94,82 +91,19 @@
9491 if(keyid & KEYID_MASK_EXTENDED){ /*制御文字*/
9592 switch(keyid & KEYID_MASK_ID){
9693 case KEYID_ENTER:
97- TextBox_Put_Character(textbox, '\n');
94+ TextBox_Internal_Put_Character(textbox, '\n');
9895 break;
9996 case KEYID_BACKSPACE:
100- TextBox_Put_Character(textbox, '\b');
97+ TextBox_Internal_Put_Character(textbox, '\b');
10198 break;
10299 case KEYID_TAB:
103- TextBox_Put_Character(textbox, '\t');
100+ TextBox_Internal_Put_Character(textbox, '\t');
104101 break;
105102 }
106103 return 0;
107104 } else{ /*ASCII文字*/
108- s[0] = keyid & KEYID_MASK_ID;
109- s[1] = 0x00;
110- if(s[0] == '\n'){
111- if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\n')){
112- textbox->location_cursor.x = 0;
113- textbox->location_cursor.y += 16;
114- }
115- } else if(s[0] == '\b'){
116- if(!(textbox->location_cursor.x <= 0 && textbox->location_cursor.y <= 0)){
117- if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){
118- textbox->location_cursor.x -= 8;
119- }
120- if(textbox->location_cursor.x < 0){
121- textbox->location_cursor.x = textbox->location_cursor_record_started.x;
122- textbox->location_cursor.y -= 16;
123- if(textbox->flags.bit.record_input_text){
124- for(i = 0; i < textbox->using_text_buf; i++){
125- if(textbox->text_buf[textbox->using_text_buf - i - 1] == '\n'){
126- break;
127- }
128- textbox->location_cursor.x += 8;
129- if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){
130- textbox->location_cursor.x = 0;
131- }
132- if(textbox->using_text_buf - i - 1 == 0){
133- break;
134- }
135- }
136- } else{
137- textbox->location_cursor.x = (int)textbox->sheet->size.x - 8;
138- }
139- }
140- }
141- } else if(s[0] == '\t'){
142- if(!textbox->flags.bit.record_input_text && TextBox_Internal_Put_Character_TextBuffer(textbox, '\t')){
143- textbox->location_cursor.x += 8 * (4 - ((textbox->location_cursor.x >> 3) & 3));
144- }
145- if(textbox->location_cursor.x > (int)textbox->sheet->size.x){
146- textbox->location_cursor.x = 8 * 4;
147- textbox->location_cursor.y += 16;
148- } else if(textbox->location_cursor.x == (int)textbox->sheet->size.x){
149- textbox->location_cursor.x = 0;
150- textbox->location_cursor.y += 16;
151- }
152- } else if(TextBox_Internal_Put_Character_TextBuffer(textbox, s[0])){
153- #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
154- debug("TextBox_Put_Character:put [%c].\n", s[0]);
155- #endif
156- Sheet_Drawing_Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s);
157- Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
158- textbox->location_cursor.x += 8;
159- if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){
160- textbox->location_cursor.x = 0;
161- textbox->location_cursor.y += 16;
162- }
163- }
105+ TextBox_Internal_Put_Character(textbox, keyid & KEYID_MASK_ID);
164106 }
165- if(textbox->location_cursor.y >= (int)textbox->sheet->size.y - (16 - 1)){
166- Sheet_Drawing_Scroll_Vertical(textbox->sheet, 16);
167- Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, (int)textbox->sheet->size.y - 16, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1);
168- textbox->location_cursor.y -= 16;
169- Sheet_RefreshSheet_All(textbox->sheet);
170- }
171- Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
172- Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
173107 }
174108
175109 return 0;
@@ -179,36 +113,43 @@
179113 {
180114 uint i;
181115
116+ if(textbox == Null){
117+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
118+ debug("TextBox_Put_String:Null textbox.\n");
119+ #endif
120+ return 0;
121+ }
122+
123+ if(!textbox->flags.bit.textbuffer_configured){
124+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
125+ debug("TextBox_Put_String:Buffer not configured.\n");
126+ #endif
127+ return 0;
128+ }
129+
182130 for(i = 0; s[i] != 0x00; i++){
183- TextBox_Put_Character(textbox, s[i]);
131+ TextBox_Internal_Put_Character(textbox, s[i]);
184132 }
185- return 0;
133+ return i;
186134 }
187135
188-bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c)
136+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c)
189137 {
190- if(!textbox->flags.bit.record_input_text){
191- return True;
138+ if(textbox == Null){
139+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
140+ debug("TextBox_Put_Character:Null textbox.\n");
141+ #endif
142+ return 1;
192143 }
193144
194- switch(c){
195- case '\b':
196- if(textbox->using_text_buf > 0){
197- textbox->using_text_buf--;
198- textbox->text_buf[textbox->using_text_buf] = 0x00;
199- return True;
200- }
201- break;
202- default:
203- if(textbox->using_text_buf < textbox->size_text_buf - 1){
204- textbox->text_buf[textbox->using_text_buf] = c;
205- textbox->using_text_buf++;
206- textbox->text_buf[textbox->using_text_buf] = 0x00;
207- return True;
208- }
209- break;
145+ if(!textbox->flags.bit.textbuffer_configured){
146+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
147+ debug("TextBox_Put_Character:Buffer not configured.\n");
148+ #endif
149+ return 2;
210150 }
211- return False;
151+
152+ return TextBox_Internal_Put_Character(textbox, c);
212153 }
213154
214155 //False->Trueでバッファリセット。
@@ -223,6 +164,13 @@
223164 return 1;
224165 }
225166
167+ if(!textbox->flags.bit.textbuffer_configured){
168+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
169+ debug("TextBox_SetEnable_RecordInputText:Buffer not configured.\n");
170+ #endif
171+ return 2;
172+ }
173+
226174 old = textbox->flags.bit.record_input_text;
227175
228176 if(old != enable){
@@ -236,3 +184,170 @@
236184
237185 return old;
238186 }
187+
188+uint TextBox_SetEnable_CursorBlink(UI_TextBox *textbox, bool enable)
189+{
190+ if(textbox == Null){
191+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
192+ debug("TextBox_SetEnable_CursorBlink:Null textbox.\n");
193+ #endif
194+ return 1;
195+ }
196+
197+ if(!textbox->flags.bit.textbuffer_configured){
198+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
199+ debug("TextBox_SetEnable_CursorBlink:Buffer not configured.\n");
200+ #endif
201+ return 2;
202+ }
203+
204+ textbox->flags.bit.cursor_blink = enable;
205+ textbox->flags.bit.cursor_state = False;
206+ TextBox_Internal_DrawCursor(textbox, False);
207+ return 0;
208+}
209+
210+uint TextBox_Cursor_Blink(UI_TextBox *textbox)
211+{
212+ if(textbox == Null){
213+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
214+ debug("TextBox_Cursor_Blink:Null textbox.\n");
215+ #endif
216+ return 1;
217+ }
218+
219+ if(!textbox->flags.bit.textbuffer_configured){
220+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
221+ debug("TextBox_Cursor_Blink:Buffer not configured.\n");
222+ #endif
223+ return 2;
224+ }
225+
226+ if(!textbox->flags.bit.cursor_blink){
227+ return 3;
228+ }
229+
230+ textbox->flags.bit.cursor_state = !textbox->flags.bit.cursor_state;
231+ TextBox_Internal_DrawCursor(textbox, textbox->flags.bit.cursor_state);
232+ return 0;
233+}
234+
235+//--------//
236+
237+uint TextBox_Internal_Put_Character(UI_TextBox *textbox, uchar c)
238+{
239+ uint i;
240+ uchar s[2];
241+
242+ s[1] = 0x00;
243+
244+ if(textbox->flags.bit.cursor_blink){
245+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
246+ Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
247+ }
248+ /*ASCII文字*/
249+ if(c == '\n'){
250+ if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\n')){
251+ textbox->location_cursor.x = 0;
252+ textbox->location_cursor.y += 16;
253+ }
254+ } else if(c == '\b'){
255+ if(!(textbox->location_cursor.x <= 0 && textbox->location_cursor.y <= 0)){
256+ if(TextBox_Internal_Put_Character_TextBuffer(textbox, '\b')){
257+ textbox->location_cursor.x -= 8;
258+ }
259+ if(textbox->location_cursor.x < 0){
260+ textbox->location_cursor.x = 0;
261+ textbox->location_cursor.y -= 16;
262+ if(textbox->flags.bit.record_input_text){
263+ for(i = 0; i < textbox->using_text_buf; i++){
264+ if(textbox->text_buf[textbox->using_text_buf - i - 1] == '\n'){
265+ break;
266+ }
267+ textbox->location_cursor.x += 8;
268+ if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){
269+ textbox->location_cursor.x = 0;
270+ }
271+ }
272+ if(i == textbox->using_text_buf){
273+ textbox->location_cursor.x += textbox->location_cursor_record_started.x;
274+ if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){
275+ textbox->location_cursor.x -= textbox->sheet->size.x;
276+ }
277+ }
278+ } else{
279+ textbox->location_cursor.x = (int)textbox->sheet->size.x - 8;
280+ }
281+ }
282+ }
283+ } else if(c == '\t'){
284+ if(!textbox->flags.bit.record_input_text && TextBox_Internal_Put_Character_TextBuffer(textbox, '\t')){
285+ textbox->location_cursor.x += 8 * (4 - ((textbox->location_cursor.x >> 3) & 3));
286+ }
287+ if(textbox->location_cursor.x > (int)textbox->sheet->size.x){
288+ textbox->location_cursor.x = 8 * 4;
289+ textbox->location_cursor.y += 16;
290+ } else if(textbox->location_cursor.x == (int)textbox->sheet->size.x){
291+ textbox->location_cursor.x = 0;
292+ textbox->location_cursor.y += 16;
293+ }
294+ } else if(TextBox_Internal_Put_Character_TextBuffer(textbox, c)){
295+ s[0] = c;
296+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
297+ Sheet_Drawing_Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s);
298+ Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
299+ textbox->location_cursor.x += 8;
300+ if(textbox->location_cursor.x >= (int)textbox->sheet->size.x - (8 - 1)){
301+ textbox->location_cursor.x = 0;
302+ textbox->location_cursor.y += 16;
303+ }
304+ }
305+ if(textbox->location_cursor.y >= (int)textbox->sheet->size.y - (16 - 1)){
306+ Sheet_Drawing_Scroll_Vertical(textbox->sheet, 16);
307+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, 0, (int)textbox->sheet->size.y - 16, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1);
308+ textbox->location_cursor.y -= 16;
309+ Sheet_RefreshSheet_All(textbox->sheet);
310+ }
311+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
312+ Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
313+
314+ return 0;
315+}
316+
317+bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c)
318+{
319+ if(!textbox->flags.bit.record_input_text){
320+ return True;
321+ }
322+
323+ switch(c){
324+ case '\b':
325+ if(textbox->using_text_buf > 0){
326+ textbox->using_text_buf--;
327+ textbox->text_buf[textbox->using_text_buf] = 0x00;
328+ return True;
329+ }
330+ break;
331+ default:
332+ if(textbox->using_text_buf < textbox->size_text_buf - 1){
333+ textbox->text_buf[textbox->using_text_buf] = c;
334+ textbox->using_text_buf++;
335+ textbox->text_buf[textbox->using_text_buf] = 0x00;
336+ return True;
337+ }
338+ break;
339+ }
340+ return False;
341+}
342+
343+uint TextBox_Internal_DrawCursor(UI_TextBox *textbox, bool cursor)
344+{
345+ if(cursor){
346+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->forecol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
347+ } else{
348+ Sheet_Drawing_Fill_Rectangle(textbox->sheet, textbox->backcol, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
349+ }
350+ Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
351+
352+ return 0;
353+}
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 326)
@@ -25,6 +25,7 @@
2525 void srand(uint seed);
2626 uint rand(void);
2727 uint isqrt(uint n);
28+bool CFunction_CompareStrings(const uchar s1[], const uchar s2[]);
2829 uint CFunction_ExtractBits(uint source, uint start, uint end);
2930 uint CFunction_MemoryMove(void *destination, uint destination_size, void *source, uint source_size);
3031 int snprintf(uchar s[], uint n, const uchar format[], ...);
@@ -57,6 +58,8 @@
5758 uint Console_SetSize(UI_Console *console, uint xchars, uint ychars);
5859 uint Console_Run(UI_Console *console);
5960 void Console_MainTask(UI_Console *myconsole);
61+bool Console_CompareCommandline_s(UI_Console *myconsole, const uchar s[]);
62+uint Console_printf(UI_Console *myconsole, const uchar format[], ...);
6063
6164 /*debug.c デバッグ支援*/
6265 #ifdef CHNOSPROJECT_DEBUG
@@ -372,10 +375,15 @@
372375 UI_TextBox *TextBox_Initialize(void);
373376 uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent);
374377 uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py);
375-uint TextBox_Put_Character(UI_TextBox *textbox, ushort keyid);
378+uint TextBox_Put_Key(UI_TextBox *textbox, ushort keyid);
376379 uint TextBox_Put_String(UI_TextBox *textbox, const uchar s[]);
380+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c);
381+bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable);
382+uint TextBox_SetEnable_CursorBlink(UI_TextBox *textbox, bool enable);
383+uint TextBox_Cursor_Blink(UI_TextBox *textbox);
384+uint TextBox_Internal_Put_Character(UI_TextBox *textbox, uchar c);
377385 bool TextBox_Internal_Put_Character_TextBuffer(UI_TextBox *textbox, uchar c);
378-bool TextBox_SetEnable_RecordInputText(UI_TextBox *textbox, bool enable);
386+uint TextBox_Internal_DrawCursor(UI_TextBox *textbox, bool cursor);
379387
380388 /*timer.c タイマー関連*/
381389 UI_TimerControl *Initialize_ProgrammableIntervalTimer(void);
--- beta/tolset_chn_000/chnos_010/chnos/cfunc.c (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/cfunc.c (revision 326)
@@ -120,6 +120,18 @@
120120 return x;
121121 }
122122
123+bool CFunction_CompareStrings(const uchar s1[], const uchar s2[])
124+{
125+ uint i;
126+
127+ for(i = 0; s1[i] == s2[i]; i++){
128+ if(s1[i] == 0x00){
129+ return True;
130+ }
131+ }
132+ return False;
133+}
134+
123135 uint CFunction_ExtractBits(uint source, uint start, uint end)
124136 {
125137 return (source >> start) & ~(0xffffffff << (end - start + 1));
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 326)
@@ -171,7 +171,7 @@
171171 //Timer_Run(timer3);
172172
173173 console = Console_Initialize();
174- Console_SetSize(console, 20, 6);
174+ Console_SetSize(console, vramsheet->size.x >> 4, vramsheet->size.y >> 5);
175175 Console_Run(console);
176176
177177 for(;;){
@@ -181,7 +181,7 @@
181181 data = FIFO32_MyTaskFIFO_Get();
182182 if(SIGNAL_KEY_OFFSET <= data && data <= (SIGNAL_KEY_OFFSET + 0xFFFF)){
183183 data -= SIGNAL_KEY_OFFSET;
184- TextBox_Put_Character(textbox, data);
184+ TextBox_Put_Key(textbox, data);
185185 if(!(data & KEYID_MASK_BREAK) && (data & KEYID_MASK_EXTENDED)){
186186 if((data & KEYID_MASK_ID) == KEYID_ENTER){
187187 TextBox_SetEnable_RecordInputText(textbox, False);
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 326)
@@ -355,3 +355,6 @@
355355 #define SHEET_MAX_CHILDREN 255
356356 #define SHEET_LOCATION_NOCHANGE 0x7ffffffe
357357
358+/*console*/
359+#define CONSOLE_PRINTF_BUFFER_SIZE 1024
360+
--- beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 325)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 326)
@@ -580,6 +580,8 @@
580580 unsigned initialized : 1;
581581 unsigned textbuffer_configured : 1;
582582 unsigned record_input_text : 1;
583+ unsigned cursor_blink : 1;
584+ unsigned cursor_state : 1;
583585 } bit;
584586 } flags;
585587 } UI_TextBox;
@@ -587,6 +589,7 @@
587589 typedef struct UI_CONSOLE {
588590 UI_TextBox *textbox;
589591 UI_Task *task;
592+ uchar *printf_buffer;
590593 union UI_CONSOLE_FLAGS {
591594 uint flags;
592595 struct UI_CONSOLE_BITS {
旧リポジトリブラウザで表示