mirror of
https://github.com/KolibriOS/kolibrios.git
synced 2024-12-23 23:26:49 +03:00
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:
parent
e167f0de89
commit
8d15602e0a
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
{
|
||||
|
@ -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";
|
||||
|
@ -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];
|
||||
|
@ -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;d<files.count;d++;) file_mas[d]=d;
|
||||
for(d=1;d<files.count;d++;) items.set(d, d);
|
||||
count_dir = d;
|
||||
return;
|
||||
}
|
||||
@ -848,12 +849,12 @@ inline Sorting()
|
||||
if (dir_at_fat16) && (file_name_is_8_3(file_off+40)) strttl(file_off+40);
|
||||
if (TestBit(ESDWORD[file_off],4)) //directory?
|
||||
{
|
||||
file_mas[d]=j;
|
||||
items.set(d, j);
|
||||
d++;
|
||||
}
|
||||
else
|
||||
{
|
||||
file_mas[files.count-f]=j;
|
||||
items.set(files.count-f, j);
|
||||
f++;
|
||||
}
|
||||
}
|
||||
@ -865,12 +866,14 @@ inline Sorting()
|
||||
else if (sort_type==3) Sort_by_Size(d,files.count-1);
|
||||
//reversed sorting
|
||||
if (sort_desc) {
|
||||
for (j=0; j<f/2; j++) file_mas[files.count-j-1]><file_mas[d+j];
|
||||
//if (sort_type==1) for (j=0; j<d/2; j++) file_mas[d-j]><file_mas[j];
|
||||
for (j=0; j<f/2; 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
|
||||
if (d>0) && (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]><file_mas[0]; break;}
|
||||
if (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<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)
|
||||
{
|
||||
files.cur_y = i - 1;
|
||||
|
@ -17,7 +17,7 @@ void DrawPathBar()
|
||||
}
|
||||
|
||||
void DrawBreadCrumbs()
|
||||
collection_int breadCrumb;
|
||||
collection_int breadCrumb=0;
|
||||
char PathShow_path[4096];
|
||||
block btn;
|
||||
int i;
|
||||
|
@ -6,9 +6,9 @@
|
||||
//===================================================//
|
||||
|
||||
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;
|
||||
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
|
||||
return;
|
||||
}
|
||||
@ -18,7 +18,7 @@ void setElementSelectedFlag(dword n, int state) {
|
||||
}
|
||||
|
||||
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];
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void EventCopy(bool _cut_active)
|
||||
for (i=0; i<files.count; i++)
|
||||
{
|
||||
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);
|
||||
size_buf += path_len + 1;
|
||||
}
|
||||
@ -85,7 +85,7 @@ void EventCopy(bool _cut_active)
|
||||
for (i=0; i<files.count; i++)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -216,7 +216,7 @@ void DeleteSelectedElements()
|
||||
for (i=0; i<files.count; i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
@ -226,7 +226,7 @@ void DeleteSelectedElements()
|
||||
for (i=0; i<files.count; i++)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ struct _SystemDiscs
|
||||
void Get();
|
||||
void Draw();
|
||||
void Click();
|
||||
} SystemDiscs;
|
||||
} SystemDiscs=0;
|
||||
|
||||
|
||||
void GetDiskIconAndName(char disk_first_letter, dword dev_icon, disc_name)
|
||||
|
@ -115,7 +115,7 @@ void SetProperties(int mode)
|
||||
{
|
||||
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);
|
||||
if (SET_PROPERTIES_ALL_SUBFOLDER == mode) {
|
||||
if (dir_exists(#pcur_file)) SetPropertiesDir(#pcur_file);
|
||||
@ -157,8 +157,8 @@ void GetSizeMoreFiles(dword way)
|
||||
{
|
||||
if (getElementSelectedFlag(i) == true)
|
||||
{
|
||||
sprintf(#cur_file,"%s/%s",way,file_mas[i]*304+buf+72);
|
||||
if (TestBit(ESDWORD[file_mas[i]*304+buf+32], 4) )
|
||||
sprintf(#cur_file,"%s/%s",way,items.get(i)*304+buf+72);
|
||||
if (TestBit(ESDWORD[items.get(i)*304+buf+32], 4) )
|
||||
{
|
||||
more_files_count.calculate_loop(#cur_file);
|
||||
more_files_count.folders++;
|
||||
|
@ -3,9 +3,13 @@ void Sort_by_Size(int a, b) //
|
||||
{
|
||||
int j;
|
||||
int iss = a;
|
||||
int size1, size2;
|
||||
if (a >= 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);
|
||||
|
@ -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 "” ©«"
|
||||
|
@ -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<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("World");
|
||||
@ -26,21 +56,3 @@ void test1()
|
||||
debugln(s.get(1)); //-> 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<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();
|
||||
}
|
@ -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;
|
||||
|
@ -2,89 +2,7 @@
|
||||
#define INCLUDE_COLLECTION_H
|
||||
#print "[include <collection.h>]\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; 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--;
|
||||
}
|
||||
#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; 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
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
//===================================================//
|
||||
// //
|
||||
|
@ -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,
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
int current_process_id = 0;
|
||||
int proc_list[256];
|
||||
collection attached;
|
||||
collection attached=0;
|
||||
|
||||
llist list;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user