diff --git a/programs/cmm/TWB/anchors.h b/programs/cmm/TWB/anchors.h index 38ea84c225..819e6cbd10 100644 --- a/programs/cmm/TWB/anchors.h +++ b/programs/cmm/TWB/anchors.h @@ -7,7 +7,7 @@ struct _anchors { int get_pos_by_name(); void clear(); void take_anchor_from(); -} anchors; +} anchors=0; void _anchors::add(dword _name, _pos) { diff --git a/programs/cmm/TWB/parse_tag.h b/programs/cmm/TWB/parse_tag.h index 94d7775158..1427e13831 100644 --- a/programs/cmm/TWB/parse_tag.h +++ b/programs/cmm/TWB/parse_tag.h @@ -12,7 +12,7 @@ struct _tag bool parse_params(); bool get_next_param(); dword get_value_of(); -} tag; +} tag=0; bool _tag::is(dword _text) { diff --git a/programs/cmm/browser/cache.h b/programs/cmm/browser/cache.h index e428bfd0a5..114feddb6e 100644 --- a/programs/cmm/browser/cache.h +++ b/programs/cmm/browser/cache.h @@ -4,22 +4,22 @@ struct PAGES_CACHE dword current_page_buf; dword current_page_size; collection url; - collection data; //it has to be int - collection size; //it has to be int + collection_int data; + collection_int size; void add(); bool has(); void clear(); -} pages_cache; +} pages_cache=0; void PAGES_CACHE::add(dword _url, _data, _size) { dword data_pointer; data_pointer = malloc(_size); memmov(data_pointer, _data, _size); - data.add(itoa(data_pointer)); + data.add(data_pointer); url.add(_url); - size.add(itoa(_size)); + size.add(_size); } bool PAGES_CACHE::has(dword _link) @@ -27,8 +27,8 @@ bool PAGES_CACHE::has(dword _link) int pos; pos = url.get_pos_by_name(_link); if (pos != -1) { - current_page_buf = atoi(data.get(pos)); - current_page_size = atoi(size.get(pos)); + current_page_buf = data.get(pos); + current_page_size = size.get(pos); return true; } return false; diff --git a/programs/cmm/browser/tabs.h b/programs/cmm/browser/tabs.h index 714aefc86e..a9e8b22a63 100644 --- a/programs/cmm/browser/tabs.h +++ b/programs/cmm/browser/tabs.h @@ -7,8 +7,8 @@ #define TABS_MAX 5 -TWebBrowser data[TABS_MAX+1]; -_history tabstory[TABS_MAX+1]; +TWebBrowser data[TABS_MAX+1]=0; +_history tabstory[TABS_MAX+1]=0; struct TAB { diff --git a/programs/cmm/browser/texts.h b/programs/cmm/browser/texts.h index 65f0460db1..0b9d8e8f4c 100644 --- a/programs/cmm/browser/texts.h +++ b/programs/cmm/browser/texts.h @@ -1,4 +1,4 @@ -char version[]="WebView 2.6"; +char version[]="WebView 2.61"; #ifdef LANG_RUS char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; diff --git a/programs/cmm/drvinst/drvinst.c b/programs/cmm/drvinst/drvinst.c index db1ef5d4b3..49716a82d4 100644 --- a/programs/cmm/drvinst/drvinst.c +++ b/programs/cmm/drvinst/drvinst.c @@ -58,7 +58,7 @@ proc_info Form; #define WINDOW_STEP_DRIVER_LIST 2; char window_step = WINDOW_STEP_INTRO; -collection ini_sections; +collection ini_sections=0; char drvinf_path[4096] = "/kolibrios/drivers/drvinf.ini"; char cur_version[64]; diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 47e0612028..62de1a3252 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -89,7 +89,7 @@ llist files, files_active, files_inactive; byte list_full_redraw; dword buf; -dword file_mas[6898]; +collection_int items=0; int selected_count; int count_dir; @@ -585,7 +585,7 @@ void DrawStatusBar() char status_bar_str[80]; int go_up_folder_exists=0; if (!show_status_bar.checked) return; - if (files.count>0) && (strcmp(file_mas[0]*304+buf+72,"..")==0) go_up_folder_exists=1; + if (files.count>0) && (streq(items.get(0)*304+buf+72,"..")) go_up_folder_exists=1; DrawBar(0, Form.cheight - status_bar_h, Form.cwidth, status_bar_h, sc.work); sprintf(#status_bar_str, T_STATUS_EVEMENTS, count_dir-go_up_folder_exists, files.count-count_dir); WriteText(6,Form.cheight - 13,0x80,sc.work_text,#status_bar_str); @@ -721,7 +721,7 @@ void Line_ReDraw(dword bgcol, filenum){ if (colored_lines.checked) && (bgcol!=col.selec) && (filenum%2) bgcol=col.odd_line; DrawBar(files.x+icon_size+4,y,files.w-icon_size-4,files.item_h,bgcol); - file_offet = file_mas[filenum+files.first]*304 + buf+32; + file_offet = items.get(filenum+files.first)*304 + buf+32; attr = ESDWORD[file_offet]; file.selected = ESBYTE[file_offet+7]; file.sizelo = ESDWORD[file_offet+32]; @@ -806,8 +806,6 @@ void Open_Dir(dword dir_path, redraw){ Write_Error(errornum); return; } - maxcount = sizeof(file_mas)/sizeof(dword)-1; - if (files.count>maxcount) files.count = maxcount; if (files.count>0) && (files.cur_y-files.first==-1) files.cur_y=0; } if (files.count!=-1) @@ -835,11 +833,14 @@ inline Sorting() { dword d=0, f=1; int j=0; + dword tmp; dword file_off; + items.drop(); + if (!strcmp(#path,"/")) //do not sort root folder { - for(d=1;d0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) - for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0) + for(d--; d>0; d--;) if (!strncmp(items.get(d)*304+buf+72,"..",2)) {items.swap(d,0); break;} } @@ -913,7 +916,7 @@ void SelectFileByName(dword that_file) files.KeyHome(); Open_Dir(#path,ONLY_OPEN); if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); - for (ind=files.count-1; ind>=0; ind--;) { if (!strcmp(file_mas[ind]*304+buf+72,that_file)) break; } + for (ind=files.count-1; ind>=0; ind--;) { if (streq(items.get(ind)*304+buf+72,that_file)) break; } files.cur_y = ind - 1; files.KeyDown(); DrawStatusBar(); @@ -1150,7 +1153,7 @@ void EventSelectFileByKeyPress() int i; for (i=files.cur_y+1; i= b) return; - for (j = a; j <= b; j++) - if (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;} + size2 = items.get(b)*304 + buf+64; + for (j = a; j <= b; j++) { + size1 = items.get(j)*304 + buf+64; + if (ESDWORD[size1] <= ESDWORD[size2]) { items.swap(iss,j); iss++;} + } Sort_by_Size (a, iss-2); Sort_by_Size (iss, b); } @@ -15,9 +19,10 @@ void Sort_by_Name(int a, b) // { int j; int isn = a; + dword name2 = items.get(b)*304 + buf+72; if (a >= b) return; for (j = a; j <= b; j++) { - if (strcmpi(file_mas[j]*304 + buf+72, file_mas[b]*304 + buf+72)<=0) { file_mas[isn] >< file_mas[j]; isn++;} + if (strcmpi(items.get(j)*304 + buf+72, name2)<=0) { items.swap(isn,j); isn++;} } Sort_by_Name(a, isn-2); Sort_by_Name(isn, b); @@ -30,10 +35,10 @@ void Sort_by_Type(int a, b) // dword filename1, filename2, ext1, ext2; int n, isn = a; if (a >= b) return; + filename2 = items.get(b)*304 + buf+72; for (j = a; j <= b; j++) { - filename1 = file_mas[j]*304 + buf+72; - filename2 = file_mas[b]*304 + buf+72; + filename1 = items.get(j)*304 + buf+72; n=strlen(filename1)-1; WHILE (n>0) && (ESBYTE[filename1+n]!='.') n--; @@ -44,8 +49,8 @@ void Sort_by_Type(int a, b) // if (n) ext2 = filename2+n+1; else ext2=0; n=strcmp(ext1, ext2); - if (n<0) { file_mas[isn] >< file_mas[j]; isn++;} - if (!n) && (strcmp(filename1, filename2) <= 0) { file_mas[isn] >< file_mas[j]; isn++;} + if (n<0) { items.swap(isn, j); isn++;} + if (!n) && (strcmp(filename1, filename2) <= 0) { items.swap(isn,j); isn++;} } Sort_by_Type(a, isn-2); Sort_by_Type(isn, b); diff --git a/programs/cmm/eolite/include/translations.h b/programs/cmm/eolite/include/translations.h index 34312831d1..7d2ffca9f2 100644 --- a/programs/cmm/eolite/include/translations.h +++ b/programs/cmm/eolite/include/translations.h @@ -1,5 +1,5 @@ -#define TITLE "Eolite File Manager 4.28b" -#define ABOUT_TITLE "EOLITE 4.28b" +#define TITLE "Eolite File Manager 4.3" +#define ABOUT_TITLE "EOLITE 4.3" #ifdef LANG_RUS ?define T_FILE "” ©«" diff --git a/programs/cmm/examples/collections.c b/programs/cmm/examples/collections.c index 527b06bd38..279bbcf35f 100644 --- a/programs/cmm/examples/collections.c +++ b/programs/cmm/examples/collections.c @@ -7,12 +7,42 @@ void main() { io.run("/sys/develop/board", ""); - test1(); - test2(); + test_int(); + test_str(); + ExitProcess(); } -void test1() - collection s; +void test_int() + collection_int ci=0; + int i; + { + ci.add(0); + ci.add(1); + ci.add(2); + ci.add(3); + debugln("-> 0 1 2 3"); + for (i=0; i 0 1 4"); + for (i=0; i 0 9 4"); + for (i=0; i 0 9 4 0 0 0 6"); + for (i=0; i 4 9 0 0 0 0 6"); + for (i=0; i Kolibri s.drop(); } - -void test2() - collection_int ci; - int i; - { - ci.add(0); - ci.add(1); - ci.add(2); - ci.add(3); - debugln("-> 0 1 2 3"); - for (i=0; i 0 1 2 3 - ci.count--; - ci.count--; - ci.add(4); - debugln("-> 0 1 4"); - for (i=0; i 0 1 4 - ci.drop(); -} \ No newline at end of file diff --git a/programs/cmm/lib/array.h b/programs/cmm/lib/array.h index 72a6b0710a..8a1182e25a 100644 --- a/programs/cmm/lib/array.h +++ b/programs/cmm/lib/array.h @@ -41,7 +41,7 @@ :byte Array::init(dword size) { dword pointer = 0; - if (!size) size = 8; + if (!size) size = 240; IF(!memory) { lenInitSize = size * 17; diff --git a/programs/cmm/lib/collection.h b/programs/cmm/lib/collection.h index b61a01dee3..b1186ec185 100644 --- a/programs/cmm/lib/collection.h +++ b/programs/cmm/lib/collection.h @@ -2,89 +2,7 @@ #define INCLUDE_COLLECTION_H #print "[include ]\n" -/*======================================================== -= = -= String = -= = -========================================================*/ - -struct collection -{ - int realloc_size, count; - dword data_start; - dword data_size; - dword element_offset[4000]; - int add(); - int addn(); - dword get(); //get_name_by_pos - dword get_pos_by_name(); - void drop(); - void increase_data_size(); - dword get_last(); - bool pop(); -}; - -:void collection::increase_data_size() { - int filled_size; - if (realloc_size<4096) realloc_size = 4096; - if (!data_size) { - data_size = realloc_size; - data_start = malloc(realloc_size); - } - else { - data_size = data_size + realloc_size; - data_start = realloc(data_start, data_size); - } -} - -:int collection::add(dword in) { - return addn(in, strlen(in)); -} - -:int collection::addn(dword in, len) { - if (count >= 4000) { - debugln("collection: more than 4000 elements!"); - return 0; - } - if (element_offset[count]+len+2 > data_size) { - increase_data_size(); - addn(in, len); - return 1; - } - strncpy(data_start+element_offset[count], in, len); - count++; - element_offset[count] = element_offset[count-1] + len + 1; - return 1; -} - -:dword collection::get(dword pos) { - if (pos<0) || (pos>=count) return 0; - return data_start + element_offset[pos]; -} - -:dword collection::get_last() { - return get(count-1); -} - -:dword collection::get_pos_by_name(dword name) { - dword i; - for (i=0; i0) count--; -} +#include "array.h" /*======================================================== = = @@ -100,6 +18,8 @@ struct collection_int void alloc(); void add(); dword get(); + void set(); + void swap(); dword len(); dword get_last(); void pop(); @@ -128,6 +48,21 @@ struct collection_int return ESDWORD[pos * sizeof(dword) + buf]; } + +:void collection_int::set(dword pos, _in) { + while (pos >= count) add(0); + EAX = pos * sizeof(dword) + buf; + ESDWORD[EAX] = _in; +} + +:void collection_int::swap(dword pos1, pos2) { + while (pos1 >= count) add(0); + while (pos2 >= count) add(0); + EAX = pos1 * sizeof(dword) + buf; + EBX = pos2 * sizeof(dword) + buf; + ESDWORD[EAX] >< ESDWORD[EBX]; +} + :dword collection_int::len(dword pos) { if (pos<0) || (pos+1>=count) return 0; return get(pos+1) - get(pos); @@ -145,4 +80,84 @@ struct collection_int count = 0; } +/*======================================================== += = += String = += = +========================================================*/ + +struct collection +{ + int realloc_size, count; + dword data_start; + dword data_size; + collection_int offset; + int add(); + int addn(); + dword get(); //get_name_by_pos + dword get_pos_by_name(); + void drop(); + void increase_data_size(); + dword get_last(); + bool pop(); +}; + +:void collection::increase_data_size() { + int filled_size; + if (realloc_size<4096) realloc_size = 4096; + if (!data_size) { + data_size = realloc_size; + data_start = malloc(realloc_size); + } + else { + data_size = data_size + realloc_size; + data_start = realloc(data_start, data_size); + } +} + +:int collection::add(dword in) { + return addn(in, strlen(in)); +} + +:int collection::addn(dword in, len) { + if (offset.get(count)+len+2 > data_size) { + increase_data_size(); + addn(in, len); + return 1; + } + strncpy(data_start+offset.get(count), in, len); + count++; + offset.set(count, offset.get(count-1) + len + 1); + return 1; +} + +:dword collection::get(dword pos) { + if (pos<0) || (pos>=count) return 0; + return data_start + offset.get(pos); +} + +:dword collection::get_last() { + return get(count-1); +} + +:dword collection::get_pos_by_name(dword name) { + dword i; + for (i=0; i0) count--; +} + #endif \ No newline at end of file diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index d2f37a4546..06c1df322f 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -10,8 +10,8 @@ #define SEP_H 4 llist menu1; -collection names; -collection hotkeys; +collection names=0; +collection hotkeys=0; int selected, win_x, win_y; diff --git a/programs/cmm/misc/calypte.c b/programs/cmm/misc/calypte.c index f6cd94bd2d..d3f2b06a36 100644 --- a/programs/cmm/misc/calypte.c +++ b/programs/cmm/misc/calypte.c @@ -116,7 +116,7 @@ dword bufsize; scroll_bar scroll_v = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; scroll_bar scroll_h = { SCROLL_SIZE,200,398,44,0,2,115,15,0,0xeeeeee,0xBBBbbb,0xeeeeee,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; -collection s; +collection s=0; //===================================================// // // diff --git a/programs/cmm/misc/software_widget.c b/programs/cmm/misc/software_widget.c index b05b93864a..b3706b7c5e 100644 --- a/programs/cmm/misc/software_widget.c +++ b/programs/cmm/misc/software_widget.c @@ -17,7 +17,7 @@ SOFTWARE CENTER v2.86 proc_info Form; llist list; -collection app_path_collection; +collection app_path_collection=0; bool kolibrios_mounted; int window_width, diff --git a/programs/cmm/taskbar2/taskbar2.c b/programs/cmm/taskbar2/taskbar2.c index 9447683ee0..7796f0c643 100644 --- a/programs/cmm/taskbar2/taskbar2.c +++ b/programs/cmm/taskbar2/taskbar2.c @@ -26,7 +26,7 @@ int current_process_id = 0; int proc_list[256]; -collection attached; +collection attached=0; llist list;