cmm/lib/collection: remove restriction of maximum elements

webview: remove restriction of links count
eolite: remove restriction of max elements in list + 6 times speed up the open of big folders!

git-svn-id: svn://kolibrios.org@7972 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2020-05-23 11:26:58 +00:00
parent e167f0de89
commit 8d15602e0a
20 changed files with 194 additions and 159 deletions

View File

@ -7,7 +7,7 @@ struct _anchors {
int get_pos_by_name(); int get_pos_by_name();
void clear(); void clear();
void take_anchor_from(); void take_anchor_from();
} anchors; } anchors=0;
void _anchors::add(dword _name, _pos) void _anchors::add(dword _name, _pos)
{ {

View File

@ -12,7 +12,7 @@ struct _tag
bool parse_params(); bool parse_params();
bool get_next_param(); bool get_next_param();
dword get_value_of(); dword get_value_of();
} tag; } tag=0;
bool _tag::is(dword _text) bool _tag::is(dword _text)
{ {

View File

@ -4,22 +4,22 @@ struct PAGES_CACHE
dword current_page_buf; dword current_page_buf;
dword current_page_size; dword current_page_size;
collection url; collection url;
collection data; //it has to be int collection_int data;
collection size; //it has to be int collection_int size;
void add(); void add();
bool has(); bool has();
void clear(); void clear();
} pages_cache; } pages_cache=0;
void PAGES_CACHE::add(dword _url, _data, _size) void PAGES_CACHE::add(dword _url, _data, _size)
{ {
dword data_pointer; dword data_pointer;
data_pointer = malloc(_size); data_pointer = malloc(_size);
memmov(data_pointer, _data, _size); memmov(data_pointer, _data, _size);
data.add(itoa(data_pointer)); data.add(data_pointer);
url.add(_url); url.add(_url);
size.add(itoa(_size)); size.add(_size);
} }
bool PAGES_CACHE::has(dword _link) bool PAGES_CACHE::has(dword _link)
@ -27,8 +27,8 @@ bool PAGES_CACHE::has(dword _link)
int pos; int pos;
pos = url.get_pos_by_name(_link); pos = url.get_pos_by_name(_link);
if (pos != -1) { if (pos != -1) {
current_page_buf = atoi(data.get(pos)); current_page_buf = data.get(pos);
current_page_size = atoi(size.get(pos)); current_page_size = size.get(pos);
return true; return true;
} }
return false; return false;

View File

@ -7,8 +7,8 @@
#define TABS_MAX 5 #define TABS_MAX 5
TWebBrowser data[TABS_MAX+1]; TWebBrowser data[TABS_MAX+1]=0;
_history tabstory[TABS_MAX+1]; _history tabstory[TABS_MAX+1]=0;
struct TAB struct TAB
{ {

View File

@ -1,4 +1,4 @@
char version[]="WebView 2.6"; char version[]="WebView 2.61";
#ifdef LANG_RUS #ifdef LANG_RUS
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0"; char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";

View File

@ -58,7 +58,7 @@ proc_info Form;
#define WINDOW_STEP_DRIVER_LIST 2; #define WINDOW_STEP_DRIVER_LIST 2;
char window_step = WINDOW_STEP_INTRO; char window_step = WINDOW_STEP_INTRO;
collection ini_sections; collection ini_sections=0;
char drvinf_path[4096] = "/kolibrios/drivers/drvinf.ini"; char drvinf_path[4096] = "/kolibrios/drivers/drvinf.ini";
char cur_version[64]; char cur_version[64];

View File

@ -89,7 +89,7 @@ llist files, files_active, files_inactive;
byte list_full_redraw; byte list_full_redraw;
dword buf; dword buf;
dword file_mas[6898]; collection_int items=0;
int selected_count; int selected_count;
int count_dir; int count_dir;
@ -585,7 +585,7 @@ void DrawStatusBar()
char status_bar_str[80]; char status_bar_str[80];
int go_up_folder_exists=0; int go_up_folder_exists=0;
if (!show_status_bar.checked) return; 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); 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); 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); 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; 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); 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]; attr = ESDWORD[file_offet];
file.selected = ESBYTE[file_offet+7]; file.selected = ESBYTE[file_offet+7];
file.sizelo = ESDWORD[file_offet+32]; file.sizelo = ESDWORD[file_offet+32];
@ -806,8 +806,6 @@ void Open_Dir(dword dir_path, redraw){
Write_Error(errornum); Write_Error(errornum);
return; 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>0) && (files.cur_y-files.first==-1) files.cur_y=0;
} }
if (files.count!=-1) if (files.count!=-1)
@ -835,11 +833,14 @@ inline Sorting()
{ {
dword d=0, f=1; dword d=0, f=1;
int j=0; int j=0;
dword tmp;
dword file_off; dword file_off;
items.drop();
if (!strcmp(#path,"/")) //do not sort root folder if (!strcmp(#path,"/")) //do not sort root folder
{ {
for(d=1;d<files.count;d++;) file_mas[d]=d; for(d=1;d<files.count;d++;) items.set(d, d);
count_dir = d; count_dir = d;
return; return;
} }
@ -848,12 +849,12 @@ inline Sorting()
if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40); if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
if (TestBit(ESDWORD[file_off],4)) //directory? if (TestBit(ESDWORD[file_off],4)) //directory?
{ {
file_mas[d]=j; items.set(d, j);
d++; d++;
} }
else else
{ {
file_mas[files.count-f]=j; items.set(files.count-f, j);
f++; f++;
} }
} }
@ -865,12 +866,14 @@ inline Sorting()
else if (sort_type==3) Sort_by_Size(d,files.count-1); else if (sort_type==3) Sort_by_Size(d,files.count-1);
//reversed sorting //reversed sorting
if (sort_desc) { if (sort_desc) {
for (j=0; j<f/2; j++) file_mas[files.count-j-1]><file_mas[d+j]; for (j=0; j<f/2; j++) {
//if (sort_type==1) for (j=0; j<d/2; j++) file_mas[d-j]><file_mas[j]; items.swap(files.count-j-1, d+j);
}
//if (sort_type==1) for (j=0; j<d/2; j++) items[d-j]><items[j];
} }
//make ".." first item in list //make ".." first item in list
if (d>0) && (strncmp(file_mas[0]*304+buf+72,"..",2)!=0) if (d>0) && (strncmp(items.get(0)*304+buf+72,"..",2)!=0)
for(d--; d>0; d--;) if (!strncmp(file_mas[d]*304+buf+72,"..",2)) {file_mas[d]><file_mas[0]; break;} 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(); files.KeyHome();
Open_Dir(#path,ONLY_OPEN); Open_Dir(#path,ONLY_OPEN);
if (dir_at_fat16) && (file_name_is_8_3(that_file)) strttl(that_file); 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.cur_y = ind - 1;
files.KeyDown(); files.KeyDown();
DrawStatusBar(); DrawStatusBar();
@ -1150,7 +1153,7 @@ void EventSelectFileByKeyPress()
int i; int i;
for (i=files.cur_y+1; i<files.count; i++) for (i=files.cur_y+1; i<files.count; i++)
{ {
strcpy(#temp, file_mas[i]*304+buf+72); strcpy(#temp, items.get(i)*304+buf+72);
if (temp[0]==key_ascii) || (temp[0]==key_ascii-32) if (temp[0]==key_ascii) || (temp[0]==key_ascii-32)
{ {
files.cur_y = i - 1; files.cur_y = i - 1;

View File

@ -17,7 +17,7 @@ void DrawPathBar()
} }
void DrawBreadCrumbs() void DrawBreadCrumbs()
collection_int breadCrumb; collection_int breadCrumb=0;
char PathShow_path[4096]; char PathShow_path[4096];
block btn; block btn;
int i; int i;

View File

@ -6,9 +6,9 @@
//===================================================// //===================================================//
void setElementSelectedFlag(dword n, int state) { void setElementSelectedFlag(dword n, int state) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7; dword selected_offset = items.get(n)*304 + buf+32 + 7;
ESBYTE[selected_offset] = state; ESBYTE[selected_offset] = state;
if (n==0) && (strncmp(file_mas[n]*304+buf+72,"..",2)==0) { if (n==0) && (strncmp(items.get(n)*304+buf+72,"..",2)==0) {
ESBYTE[selected_offset] = false; //do not selec ".." directory ESBYTE[selected_offset] = false; //do not selec ".." directory
return; return;
} }
@ -18,7 +18,7 @@ void setElementSelectedFlag(dword n, int state) {
} }
int getElementSelectedFlag(dword n) { int getElementSelectedFlag(dword n) {
dword selected_offset = file_mas[n]*304 + buf+32 + 7; dword selected_offset = items.get(n)*304 + buf+32 + 7;
return ESBYTE[selected_offset]; return ESBYTE[selected_offset];
} }
@ -71,7 +71,7 @@ void EventCopy(bool _cut_active)
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
if (getElementSelectedFlag(i) == true) { if (getElementSelectedFlag(i) == true) {
sprintf(#copy_t,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#copy_t,"%s/%s",#path,items.get(i)*304+buf+72);
path_len = strlen(#copy_t); path_len = strlen(#copy_t);
size_buf += path_len + 1; size_buf += path_len + 1;
} }
@ -85,7 +85,7 @@ void EventCopy(bool _cut_active)
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
if (getElementSelectedFlag(i) == true) { if (getElementSelectedFlag(i) == true) {
sprintf(copy_buf_offset,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(copy_buf_offset,"%s/%s",#path,items.get(i)*304+buf+72);
copy_buf_offset += strlen(copy_buf_offset) + 1; copy_buf_offset += strlen(copy_buf_offset) + 1;
} }
} }
@ -216,7 +216,7 @@ void DeleteSelectedElements()
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
if (getElementSelectedFlag(i) == true) { if (getElementSelectedFlag(i) == true) {
sprintf(#del_from,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#del_from,"%s/%s",#path,items.get(i)*304+buf+72);
copy_bar.max += GetFilesCount(#del_from); copy_bar.max += GetFilesCount(#del_from);
} }
} }
@ -226,7 +226,7 @@ void DeleteSelectedElements()
for (i=0; i<files.count; i++) for (i=0; i<files.count; i++)
{ {
if (getElementSelectedFlag(i) == true) { if (getElementSelectedFlag(i) == true) {
sprintf(#del_from,"%s/%s", #path, file_mas[i]*304+buf+72); sprintf(#del_from,"%s/%s", #path, items.get(i)*304+buf+72);
Del_File2(#del_from, 1); Del_File2(#del_from, 1);
} }
} }

View File

@ -44,7 +44,7 @@ struct _SystemDiscs
void Get(); void Get();
void Draw(); void Draw();
void Click(); void Click();
} SystemDiscs; } SystemDiscs=0;
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name) void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)

View File

@ -115,7 +115,7 @@ void SetProperties(int mode)
{ {
if (getElementSelectedFlag(i) == true) if (getElementSelectedFlag(i) == true)
{ {
sprintf(#pcur_file,"%s/%s",#path,file_mas[i]*304+buf+72); sprintf(#pcur_file,"%s/%s",#path,items.get(i)*304+buf+72);
SetPropertiesFile(#pcur_file, #file_info_general); SetPropertiesFile(#pcur_file, #file_info_general);
if (SET_PROPERTIES_ALL_SUBFOLDER == mode) { if (SET_PROPERTIES_ALL_SUBFOLDER == mode) {
if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file); if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file);
@ -157,8 +157,8 @@ void GetSizeMoreFiles(dword way)
{ {
if (getElementSelectedFlag(i) == true) if (getElementSelectedFlag(i) == true)
{ {
sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72); sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72);
if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) ) if (TestBit(ESDWORD[items.get(i)*304+buf+32], 4) )
{ {
more_files_count.calculate_loop(#cur_file); more_files_count.calculate_loop(#cur_file);
more_files_count.folders++; more_files_count.folders++;

View File

@ -3,9 +3,13 @@ void Sort_by_Size(int a, b) //
{ {
int j; int j;
int iss = a; int iss = a;
int size1, size2;
if (a >= b) return; if (a >= b) return;
for (j = a; j <= b; j++) size2 = items.get(b)*304 + buf+64;
if (ESDWORD[file_mas[j]*304 + buf+64] <= ESDWORD[file_mas[b]*304 + buf+64]) { file_mas[iss] >< file_mas[j]; iss++;} 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 (a, iss-2);
Sort_by_Size (iss, b); Sort_by_Size (iss, b);
} }
@ -15,9 +19,10 @@ void Sort_by_Name(int a, b) //
{ {
int j; int j;
int isn = a; int isn = a;
dword name2 = items.get(b)*304 + buf+72;
if (a >= b) return; if (a >= b) return;
for (j = a; j <= b; j++) { 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(a, isn-2);
Sort_by_Name(isn, b); Sort_by_Name(isn, b);
@ -30,10 +35,10 @@ void Sort_by_Type(int a, b) //
dword filename1, filename2, ext1, ext2; dword filename1, filename2, ext1, ext2;
int n, isn = a; int n, isn = a;
if (a >= b) return; if (a >= b) return;
filename2 = items.get(b)*304 + buf+72;
for (j = a; j <= b; j++) for (j = a; j <= b; j++)
{ {
filename1 = file_mas[j]*304 + buf+72; filename1 = items.get(j)*304 + buf+72;
filename2 = file_mas[b]*304 + buf+72;
n=strlen(filename1)-1; n=strlen(filename1)-1;
WHILE (n>0) && (ESBYTE[filename1+n]!='.') n--; 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; if (n) ext2 = filename2+n+1; else ext2=0;
n=strcmp(ext1, ext2); n=strcmp(ext1, ext2);
if (n<0) { file_mas[isn] >< file_mas[j]; isn++;} if (n<0) { items.swap(isn, j); isn++;}
if (!n) && (strcmp(filename1, filename2) <= 0) { file_mas[isn] >< file_mas[j]; isn++;} if (!n) && (strcmp(filename1, filename2) <= 0) { items.swap(isn,j); isn++;}
} }
Sort_by_Type(a, isn-2); Sort_by_Type(a, isn-2);
Sort_by_Type(isn, b); Sort_by_Type(isn, b);

View File

@ -1,5 +1,5 @@
#define TITLE "Eolite File Manager 4.28b" #define TITLE "Eolite File Manager 4.3"
#define ABOUT_TITLE "EOLITE 4.28b" #define ABOUT_TITLE "EOLITE 4.3"
#ifdef LANG_RUS #ifdef LANG_RUS
?define T_FILE "” ©«" ?define T_FILE "” ©«"

View File

@ -7,12 +7,42 @@
void main() void main()
{ {
io.run("/sys/develop/board", ""); io.run("/sys/develop/board", "");
test1(); test_int();
test2(); test_str();
ExitProcess();
} }
void test1() void test_int()
collection s; 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<ci.count; i++) debugln(itoa(ci.get(i)));
ci.pop();
ci.pop();
ci.add(4);
debugln("-> 0 1 4");
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
ci.set(1,9);
debugln("-> 0 9 4");
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
ci.set(6,6);
debugln("-> 0 9 4 0 0 0 6");
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
ci.swap(0,2);
debugln("-> 4 9 0 0 0 0 6");
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
}
void test_str()
collection s=0;
{ {
s.add("Hello"); s.add("Hello");
s.add("World"); s.add("World");
@ -26,21 +56,3 @@ void test1()
debugln(s.get(1)); //-> Kolibri debugln(s.get(1)); //-> Kolibri
s.drop(); 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<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 2 3
ci.count--;
ci.count--;
ci.add(4);
debugln("-> 0 1 4");
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 4
ci.drop();
}

View File

@ -41,7 +41,7 @@
:byte Array::init(dword size) :byte Array::init(dword size)
{ {
dword pointer = 0; dword pointer = 0;
if (!size) size = 8; if (!size) size = 240;
IF(!memory) IF(!memory)
{ {
lenInitSize = size * 17; lenInitSize = size * 17;

View File

@ -2,89 +2,7 @@
#define INCLUDE_COLLECTION_H #define INCLUDE_COLLECTION_H
#print "[include <collection.h>]\n" #print "[include <collection.h>]\n"
/*======================================================== #include "array.h"
= =
= 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; i<count; i++) {
if (strcmp(data_start + element_offset[i], name)==0) return i;
}
return -1;
}
:void collection::drop() {
if (data_start) free(data_start);
data_size = 0;
data_start = 0;
element_offset[count] = 0;
count = 0;
}
:bool collection::pop() {
if (count>0) count--;
}
/*======================================================== /*========================================================
= = = =
@ -100,6 +18,8 @@ struct collection_int
void alloc(); void alloc();
void add(); void add();
dword get(); dword get();
void set();
void swap();
dword len(); dword len();
dword get_last(); dword get_last();
void pop(); void pop();
@ -128,6 +48,21 @@ struct collection_int
return ESDWORD[pos * sizeof(dword) + buf]; 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) { :dword collection_int::len(dword pos) {
if (pos<0) || (pos+1>=count) return 0; if (pos<0) || (pos+1>=count) return 0;
return get(pos+1) - get(pos); return get(pos+1) - get(pos);
@ -145,4 +80,84 @@ struct collection_int
count = 0; 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; i<count; i++) {
if (strcmp(data_start + offset.get(i), name)==0) return i;
}
return -1;
}
:void collection::drop() {
if (data_start) free(data_start);
data_size = 0;
data_start = 0;
offset.drop();
count = 0;
}
:bool collection::pop() {
if (count>0) count--;
}
#endif #endif

View File

@ -10,8 +10,8 @@
#define SEP_H 4 #define SEP_H 4
llist menu1; llist menu1;
collection names; collection names=0;
collection hotkeys; collection hotkeys=0;
int selected, win_x, win_y; int selected, win_x, win_y;

View File

@ -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_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}; 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;
//===================================================// //===================================================//
// // // //

View File

@ -17,7 +17,7 @@ SOFTWARE CENTER v2.86
proc_info Form; proc_info Form;
llist list; llist list;
collection app_path_collection; collection app_path_collection=0;
bool kolibrios_mounted; bool kolibrios_mounted;
int window_width, int window_width,

View File

@ -26,7 +26,7 @@
int current_process_id = 0; int current_process_id = 0;
int proc_list[256]; int proc_list[256];
collection attached; collection attached=0;
llist list; llist list;