• R/O
  • SSH
  • HTTPS

chnosproject: コミット


コミットメタ情報

リビジョン323 (tree)
日時2012-07-07 20:49:31
作者hikarupsp

ログメッセージ

struct.cを追加。システムの管理にかかわる構造体を共通で扱えるようにすることが目的。
textbox.cを追加。簡易的な実装。
シートの下の階層から上の階層への自動的なリフレッシュを追加。
保存コミット。

変更サマリ

差分

--- beta/tolset_chn_000/chnos_010/chnos/sheet.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/sheet.c (revision 323)
@@ -7,9 +7,10 @@
77 {
88 UI_Sheet *sheet;
99
10- sheet = System_Memory_Allocate(sizeof(UI_Sheet));
10+ sheet = (UI_Sheet *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_SHEET);
1111
1212 sheet->flags.bit.initialized = True;
13+ sheet->flags.bit.autorefresh_upperlevel = True;
1314
1415 #ifdef CHNOSPROJECT_DEBUG_SHEET
1516 debug("Sheet_Initialise:[0x%08X]\n", sheet);
@@ -77,7 +78,7 @@
7778 System_Memory_Free(sheet->vram, sheet->vramsize);
7879 }
7980
80- System_Memory_Free(sheet, sizeof(UI_Sheet));
81+ System_CommonStruct_Free(&sheet->common_tag);
8182
8283 return 0;
8384 }
--- beta/tolset_chn_000/chnos_010/chnos/shtfunc.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/shtfunc.c (revision 323)
@@ -460,6 +460,13 @@
460460
461461 retv = sheet->RefreshSheet(sheet, px0, py0, px1, py1);
462462
463+ if(sheet->flags.bit.autorefresh_upperlevel && sheet->parent->parent != Null){
464+ //無限再帰を防ぐため、一時的に上位階層オートリフレッシュを無効にする
465+ sheet->flags.bit.autorefresh_upperlevel = False;
466+ Sheet_RefreshSheet(sheet->parent, px0, py0, px1, py1);
467+ sheet->flags.bit.autorefresh_upperlevel = True;
468+ }
469+
463470 if(retv != 0){
464471 return 10 + retv;
465472 }
--- beta/tolset_chn_000/chnos_010/chnos/mtask.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/mtask.c (revision 323)
@@ -173,7 +173,7 @@
173173 task->flags.running = True;
174174
175175 #ifdef CHNOSPROJECT_DEBUG_MULTITASK
176- debug("MultiTask_Task_Run:Start Running(sel:0x%X last:0x%X start:0x%X).\n", task->selector, last, ctrl->start);
176+ debug("MultiTask_Task_Run:Start Running(sel:0x%X).\n", task->selector);
177177 #endif
178178
179179 if(task->flags.first_run){
--- beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/makeset.txt (revision 323)
@@ -1,3 +1,3 @@
11
2-OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj chnlogo.obj callbios.obj cfunc.obj color.obj debug.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mouse.obj mtask.obj pci.obj serial.obj sheet.obj sht08.obj sht16.obj sht32.obj shtdraw.obj shtfunc.obj system.obj timer.obj vgatmode.obj xception.obj bootpack.obj
2+OBJS_BOOTPACK = nasfunc0.obj nasfunc1.obj nasfunc2.obj hankaku.obj chnlogo.obj callbios.obj cfunc.obj color.obj debug.obj display.obj draw08.obj draw16.obj draw32.obj drawing.obj dsctbl.obj emu86.obj emu86asm.obj error.obj fifo.obj fmt_bmp.obj intrpt.obj keyboard.obj memory.obj mouse.obj mtask.obj pci.obj serial.obj sheet.obj sht08.obj sht16.obj sht32.obj shtdraw.obj shtfunc.obj struct.obj system.obj textbox.obj timer.obj vgatmode.obj xception.obj bootpack.obj
33 HEADS_BOOTPACK = core.h coredef0.h coredef1.h coredef2.h coredef3.h keyid.h
--- beta/tolset_chn_000/chnos_010/chnos/textbox.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/textbox.c (revision 323)
@@ -0,0 +1,76 @@
1+
2+#include "core.h"
3+
4+UI_TextBox *TextBox_Initialise(void)
5+{
6+ UI_TextBox *textbox;
7+
8+ textbox = System_Memory_Allocate(sizeof(UI_TextBox));
9+ textbox->flags.bit.initialized = True;
10+
11+ textbox->forecol = 0x000000;
12+ textbox->backcol = 0xffffff;
13+
14+ return textbox;
15+}
16+
17+//bpp==0:自動選択(現在のシステムシートの設定に合わせる)
18+uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent)
19+{
20+ if(textbox == Null){
21+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
22+ debug("TextBox_SetBuffer:Null textbox.");
23+ return 1;
24+ #endif
25+ }
26+
27+ textbox->chars.x = xchars;
28+ textbox->chars.y = ychars;
29+ textbox->size_text_buf = textbox->chars.x * textbox->chars.y;
30+
31+ textbox->sheet = Sheet_Initialise();
32+ Sheet_SetBuffer(textbox->sheet, Null, xchars << 3, ychars << 4, bpp);
33+ Sheet_SetParent(textbox->sheet, parent);
34+
35+ textbox->sheet->Drawing.Fill_Rectangle(textbox->sheet, textbox->backcol, 0, 0, (int)textbox->sheet->size.x - 1, (int)textbox->sheet->size.y - 1);
36+
37+ textbox->text_buf = System_Memory_Allocate(textbox->size_text_buf);
38+ textbox->text_buf[0] = Null;
39+
40+ textbox->flags.bit.textbuffer_configured = True;
41+
42+ return 0;
43+}
44+
45+uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py)
46+{
47+ if(textbox == Null){
48+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
49+ debug("TextBox_Show:Null textbox.");
50+ return 1;
51+ #endif
52+ }
53+
54+ return Sheet_Show(textbox->sheet, height, px, py);
55+}
56+
57+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c)
58+{
59+ uchar s[2];
60+
61+ s[0] = c;
62+ s[1] = 0x00;
63+
64+ #ifdef CHNOSPROJECT_DEBUG_TEXTBOX
65+ debug("TextBox_Put_Character:put [%c].\n", c);
66+ #endif
67+
68+ textbox->sheet->Drawing.Put_String(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->forecol, s);
69+ Sheet_RefreshSheet(textbox->sheet, textbox->location_cursor.x, textbox->location_cursor.y, textbox->location_cursor.x + 8 - 1, textbox->location_cursor.y + 16 - 1);
70+
71+ textbox->location_cursor.x += 8;
72+ return 0;
73+}
74+
75+
76+
--- beta/tolset_chn_000/chnos_010/chnos/core.h (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/core.h (revision 323)
@@ -4,7 +4,8 @@
44 #include "coredef1.h" /*システムデータ型宣言*/
55 #include "coredef2.h" /*システム外部リソース宣言*/
66 #include "coredef3.h" /*TaskControlMessage宣言*/
7-#include "keyid.h" /*KeyIdentifier キーID宣言*/
7+#include "keyid.h" /*KeyIdentifier キーID宣言*/
8+#include "structid.h" /*SystemCommonStructID宣言*/
89
910 /*functions*/
1011 /*bootpack.c 基幹部分*/
@@ -323,6 +324,11 @@
323324 bool Sheet_Internal_IsVisiblePixel_Invalid(UI_Sheet *sheet, int px, int py);
324325 uint Sheet_Internal_RefreshSheet_Invalid(struct UI_SHEET *sheet, int px0, int py0, int px1, int py1);
325326
327+/*struct.c システム構造体共通管理ルーチン*/
328+System_CommonStruct *System_CommonStruct_Allocate(uint structid);
329+uint System_CommonStruct_Free(System_CommonStruct *str);
330+
331+
326332 /*system.c システムデータ・初期化関連*/
327333 void Initialise_System(void);
328334 void System_Set_RunningPhase(uint phase);
@@ -352,6 +358,12 @@
352358 uint System_TaskControlMessage_Send_AllTask(uint message);
353359 uint System_Sheet_SetParentToVRAM(UI_Sheet *sheet);
354360
361+/*textbox.c テキスト入力UI関連*/
362+UI_TextBox *TextBox_Initialise(void);
363+uint TextBox_SetBuffer(UI_TextBox *textbox, uint xchars, uint ychars, uint bpp, UI_Sheet *parent);
364+uint TextBox_Show(UI_TextBox *textbox, uint height, int px, int py);
365+uint TextBox_Put_Character(UI_TextBox *textbox, uchar c);
366+
355367 /*timer.c タイマー関連*/
356368 UI_TimerControl *Initialise_ProgrammableIntervalTimer(void);
357369 void InterruptHandler20(uint *esp);
--- beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/bootpack.c (revision 323)
@@ -13,6 +13,7 @@
1313 int x, y;
1414 UI_Timer *timer1, *timer2, *timer3;
1515 uint counter1, counter2, counter3;
16+ UI_TextBox *textbox;
1617
1718 i = 0;
1819 data = 0;
@@ -106,6 +107,11 @@
106107
107108 Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 4, 24, testsheet->size.x - 4 - 1, testsheet->size.y - 4 - 1);
108109
110+ textbox = TextBox_Initialise();
111+ TextBox_SetBuffer(textbox, 20, 6, 8, testsheet);
112+ TextBox_Show(textbox, 0, 4, 24);
113+
114+
109115 Drawing08_Put_String(testsheet->vram, testsheet->size.x, 4, 4, 0xffffff, "TestSheet");
110116 snprintf(s, sizeof(s), "Memory:%d Bytes", System_Get_PhisycalMemorySize());
111117 Drawing08_Put_String(testsheet->vram, testsheet->size.x, 8, 24 + 16 * 4, 0xffffff, s);
@@ -194,6 +200,8 @@
194200 } else if((data & KEYID_MASK_ID) == KEYID_ENTER){
195201 Sheet_Slide_Absolute(testsheet, disp_ctrl->xsize >> 1, disp_ctrl->ysize >> 1);
196202 }
203+ } else if(!(data & KEYID_MASK_BREAK) && !(data & KEYID_MASK_EXTENDED)){
204+ TextBox_Put_Character(textbox, data & KEYID_MASK_ID);
197205 }
198206 } else if(data == 11){
199207 Drawing08_Fill_Rectangle(testsheet->vram, testsheet->size.x, 0xc6c6c6, 8, 24, 8 + (20 * 8) - 1, 24 + (16 * 2) - 1);
@@ -332,15 +340,7 @@
332340 Sheet_Drawing_Fill_Rectangle(mouseinfosheet, 0xccffff, 4, 24 + (16 * 2), mouseinfosheet->size.x - 1 - 4, 24 + (16 * 2) + 15);
333341 snprintf(s, sizeof(s), "Button:lrc");
334342 #endif
335-/*
336- if(mctrl->button.bit.L){
337- #ifdef CHNOSPROJECT_DEBUG_MCT
338- s[7] -= 0x20;
339- #endif
340- moveorg_mfocus.x += mctrl->move.x;
341- moveorg_mfocus.y += mctrl->move.y;
342- }
343-*/
343+
344344 if(old_mouse_buttonL != mctrl->button.bit.L){
345345 if(old_mouse_buttonL){ //up
346346 if(mfocus != Null){
@@ -357,17 +357,24 @@
357357 }
358358 old_mouse_buttonL = mctrl->button.bit.L;
359359 }
360- if(mctrl->button.bit.R){
361- #ifdef CHNOSPROJECT_DEBUG_MCT
362- s[8] -= 0x20;
363- #endif
364- }
365- if(mctrl->button.bit.C){
366- #ifdef CHNOSPROJECT_DEBUG_MCT
367- s[9] -= 0x20;
368- #endif
369- }
370360 #ifdef CHNOSPROJECT_DEBUG_MCT
361+ if(mctrl->button.bit.L){
362+ #ifdef CHNOSPROJECT_DEBUG_MCT
363+ s[7] -= 0x20;
364+ #endif
365+ }
366+ if(mctrl->button.bit.R){
367+ #ifdef CHNOSPROJECT_DEBUG_MCT
368+ s[8] -= 0x20;
369+ #endif
370+ }
371+ if(mctrl->button.bit.C){
372+ #ifdef CHNOSPROJECT_DEBUG_MCT
373+ s[9] -= 0x20;
374+ #endif
375+ }
376+ #endif
377+ #ifdef CHNOSPROJECT_DEBUG_MCT
371378 Sheet_Drawing_Put_String(mouseinfosheet, 4, 24 + (16 * 2), 0x000000, s);
372379 #endif
373380 if(mctrl->flags.scroll){
--- beta/tolset_chn_000/chnos_010/chnos/structid.h (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/structid.h (revision 323)
@@ -0,0 +1,4 @@
1+
2+#define SYSTEM_STRUCTID_UNDEFINED 0
3+#define SYSTEM_STRUCTID_SHEET 1
4+#define SYSTEM_STRUCTID_FIFO32 2
--- beta/tolset_chn_000/chnos_010/chnos/pci.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/pci.c (revision 323)
@@ -105,33 +105,37 @@
105105
106106 void Initialise_PCI(void)
107107 {
108- uint data, bus, device, function;
108+ #ifdef CHNOSPROJECT_DEBUG_PCI
109+ uint data, bus, device, function;
110+ #endif
109111
110112 //PCICAR初期化
111113 IO_Out32(PORT_PCI_CONFIG_ADDRESS, 0x00000000);
112114
113- for(bus = 0; bus < 256; bus++){
114- for(device = 0; device < 32; device++){
115- for(function = 0; function < 8; function++){
116- PCI_ConfigurationRegister_SelectDevice(bus, device, function);
117- data = PCI_ConfigurationRegister_Read32(0x00);
118- if(data != 0xffffffff){
119- debug("PCI:Bus%d.Device%d.Function%d:\n", bus, device, function);
120- debug("PCI: DeviceVendor:%s(0x%04X)\n", PCI_GetDeviceVendor(data & 0xffff), data & 0xffff);
115+ #ifdef CHNOSPROJECT_DEBUG_PCI
116+ for(bus = 0; bus < 256; bus++){
117+ for(device = 0; device < 32; device++){
118+ for(function = 0; function < 8; function++){
119+ PCI_ConfigurationRegister_SelectDevice(bus, device, function);
120+ data = PCI_ConfigurationRegister_Read32(0x00);
121+ if(data != 0xffffffff){
122+ debug("PCI:Bus%d.Device%d.Function%d:\n", bus, device, function);
123+ debug("PCI: DeviceVendor:%s(0x%04X)\n", PCI_GetDeviceVendor(data & 0xffff), data & 0xffff);
121124
122- debug("PCI: DeviceID:0x%04X\n", data >> 16);
125+ debug("PCI: DeviceID:0x%04X\n", data >> 16);
123126
124- data = PCI_ConfigurationRegister_Read32(0x08);
125- data = CFunction_ExtractBits(data, 8, 31);
126- debug("PCI: ClassCode:%s(0x%06X)\n", PCI_GetDeviceClass(data), data);
127+ data = PCI_ConfigurationRegister_Read32(0x08);
128+ data = CFunction_ExtractBits(data, 8, 31);
129+ debug("PCI: ClassCode:%s(0x%06X)\n", PCI_GetDeviceClass(data), data);
127130
128- data = PCI_ConfigurationRegister_Read32(0x0c);
129- data = CFunction_ExtractBits(data, 16, 22);
130- debug("PCI: DeviceType:%s(%d)\n", PCI_GetDeviceType(data), data);
131+ data = PCI_ConfigurationRegister_Read32(0x0c);
132+ data = CFunction_ExtractBits(data, 16, 22);
133+ debug("PCI: DeviceType:%s(%d)\n", PCI_GetDeviceType(data), data);
134+ }
131135 }
132136 }
133137 }
134- }
138+ #endif
135139
136140 return;
137141 }
--- beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/fifo.c (revision 323)
@@ -8,7 +8,8 @@
88 {
99 DATA_FIFO32 *fifo;
1010
11- fifo = Memory_Allocate(memctrl, sizeof(DATA_FIFO32));
11+ //fifo = Memory_Allocate(memctrl, sizeof(DATA_FIFO32));
12+ fifo = (DATA_FIFO32 *)System_CommonStruct_Allocate(SYSTEM_STRUCTID_FIFO32);
1213
1314 fifo->size = size >> 2;
1415 fifo->buf = Memory_Allocate(memctrl, fifo->size << 2);
@@ -152,8 +153,7 @@
152153 fifo->p = 0; /*write*/
153154 fifo->q = 0; /*read*/
154155
155- System_Memory_Free(fifo, sizeof(DATA_FIFO32));
156-
156+ System_CommonStruct_Free(&fifo->common_tag);
157157 return;
158158 }
159159
--- beta/tolset_chn_000/chnos_010/chnos/struct.c (nonexistent)
+++ beta/tolset_chn_000/chnos_010/chnos/struct.c (revision 323)
@@ -0,0 +1,49 @@
1+
2+/*システム構造体共通管理ルーチン*/
3+
4+#include "core.h"
5+
6+System_CommonStruct *System_CommonStruct_Allocate(uint structid)
7+{
8+ uint strsize;
9+ System_CommonStruct *str;
10+
11+ strsize = 0;
12+ switch(structid){
13+ case SYSTEM_STRUCTID_SHEET:
14+ strsize = sizeof(UI_Sheet);
15+ break;
16+ case SYSTEM_STRUCTID_FIFO32:
17+ strsize = sizeof(DATA_FIFO32);
18+ break;
19+ default:
20+ #ifdef CHNOSPROJECT_DEBUG_COMMON_STRUCT
21+ debug("System_CommonStruct_Allocate:Unknown Struct.\n");
22+ #endif
23+ return Null;
24+ }
25+
26+ str = System_Memory_Allocate(strsize);
27+ str->structid = structid;
28+ str->structsize = strsize;
29+
30+ return str;
31+}
32+
33+uint System_CommonStruct_Free(System_CommonStruct *str)
34+{
35+ switch(str->structid){
36+ case SYSTEM_STRUCTID_SHEET:
37+ case SYSTEM_STRUCTID_FIFO32:
38+ break;
39+ default:
40+ #ifdef CHNOSPROJECT_DEBUG_COMMON_STRUCT
41+ debug("System_CommonStruct_Free:Unknown Struct.\n");
42+ #endif
43+ return 1;
44+ }
45+ str->structid = SYSTEM_STRUCTID_UNDEFINED;
46+ System_Memory_Free(str, str->structsize);
47+ return 0;
48+}
49+
--- beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef0.h (revision 323)
@@ -19,6 +19,9 @@
1919 //#define CHNOSPROJECT_DEBUG_SHEET
2020 //#define CHNOSPROJECT_DEBUG_TIMER
2121 //#define CHNOSPROJECT_DEBUG_MULTITASK
22+ //#define CHNOSPROJECT_DEBUG_PCI
23+ //#define CHNOSPROJECT_DEBUG_COMMON_STRUCT
24+ #define CHNOSPROJECT_DEBUG_TEXTBOX
2225 #endif
2326
2427 /*defines*/
--- beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 322)
+++ beta/tolset_chn_000/chnos_010/chnos/coredef1.h (revision 323)
@@ -240,8 +240,15 @@
240240
241241 typedef IO_MemoryControlTag* IO_MemoryControl;
242242
243+/*common tag*/
244+typedef struct SYSTEM_COMMON_STRUCT {
245+ uint structid;
246+ uint structsize;
247+} System_CommonStruct;
248+
243249 /*FIFO*/
244250 typedef struct FIFO32 {
251+ System_CommonStruct common_tag;
245252 uint *buf;
246253 uint p, q, size, free;
247254 struct FIFO32_FLAGS {
@@ -453,6 +460,7 @@
453460
454461 /*sheet*/
455462 typedef struct UI_SHEET {
463+ System_CommonStruct common_tag;
456464 struct UI_SHEET *parent; //one sheet has one parent(if vramseet then:0)
457465 struct UI_SHEET *next; //same level sheet link
458466 struct UI_SHEET *child; //children lowest height
@@ -470,6 +478,7 @@
470478 unsigned using_invcol : 1;
471479 unsigned topmost : 1;
472480 unsigned movable : 1;
481+ unsigned autorefresh_upperlevel : 1;
473482 } bit;
474483 } flags;
475484 void *vram;
@@ -550,3 +559,22 @@
550559 } flags;
551560 uchar *cursors[4];
552561 } UI_MouseCursor;
562+
563+/*textbox*/
564+typedef struct UI_TEXT_BOX {
565+ UI_Sheet *sheet;
566+ uint forecol;
567+ uint backcol;
568+ DATA_Location2D location_cursor;
569+ DATA_Location2DU chars;
570+ uchar *text_buf;
571+ uint size_text_buf;
572+ union UI_TEXT_BOX_FLAGS {
573+ uint flags;
574+ struct UI_TEXT_BOX_BITS {
575+ unsigned initialized : 1;
576+ unsigned textbuffer_configured : 1;
577+ } bit;
578+ } flags;
579+} UI_TextBox;
580+
旧リポジトリブラウザで表示