From eb33af59d1968e7f42b8bb006e20c1b32f1d5c74 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Thu, 7 May 2020 10:05:01 +0000 Subject: [PATCH] add backy to IMG, update cmm/lib/collection.h git-svn-id: svn://kolibrios.org@7885 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 3 ++- programs/cmm/lib/collection.h | 39 ++++++++++++++++++++++------------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/data/Tupfile.lua b/data/Tupfile.lua index e505fdfa21..13aab732bf 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -28,6 +28,7 @@ img_files = { {"UNIMG", PROGS .. "/fs/unimg/unimg"}, {"VMODE", "common/vmode"}, {"3D/HOUSE.3DS", "common/3d/house.3ds"}, + {"DEVELOP/BACKY", PROGS .. "/develop/backy/Backy"}, {"DEVELOP/T_EDIT.INI", PROGS .. "/other/t_edit/t_edit.ini"}, {"File Managers/ICONS.INI", "common/File Managers/icons.ini"}, {"File Managers/KFM.INI", "common/File Managers/kfm.ini"}, @@ -625,12 +626,12 @@ tup.append_table(img_files, { {"NETWORK/WEBVIEW", PROGS .. "/cmm/browser/WebView.com"}, }) tup.append_table(extra_files, { + {"kolibrios/develop/utils/codeview", PROGS .. "/cmm/codeview/codeview.com"}, {"kolibrios/drivers/drvinst.kex", PROGS .. "/cmm/drvinst/drvinst.com"}, {"kolibrios/games/pig/pigex", PROGS .. "/cmm/examples/pigex.com"}, {"kolibrios/games/the_bus/the_bus", PROGS .. "/cmm/the_bus/the_bus.com"}, {"kolibrios/KolibriNext/install.kex", PROGS .. "/cmm/installer/install.com"}, {"kolibrios/utils/appearance", PROGS .. "/cmm/appearance/appearance.com"}, - {"kolibrios/utils/codeview", PROGS .. "/cmm/codeview/codeview.com"}, {"kolibrios/utils/dicty.kex", PROGS .. "/cmm/dicty/dicty.com"}, {"kolibrios/utils/netcheck", PROGS .. "/cmm/examples/netcheck.com"}, {"kolibrios/utils/notes", PROGS .. "/cmm/notes/notes.com"}, diff --git a/programs/cmm/lib/collection.h b/programs/cmm/lib/collection.h index f52268e8d4..e8c411a164 100644 --- a/programs/cmm/lib/collection.h +++ b/programs/cmm/lib/collection.h @@ -21,7 +21,7 @@ struct collection void drop(); void increase_data_size(); dword get_last(); - bool delete_last(); + bool pop(); }; :void collection::increase_data_size() { @@ -82,8 +82,8 @@ struct collection count = 0; } -:bool collection::delete_last() { - count--; +:bool collection::pop() { + if (count>0) count--; } /*======================================================== @@ -94,29 +94,41 @@ struct collection struct collection_int { - int count; - dword element[4096*3]; - int add(); + dword buf; + dword buf_size; + unsigned count; + void alloc(); + void add(); dword get(); dword get_last(); void pop(); void drop(); }; -:int collection_int::add(dword in) { - if (count >= 4096*3) return 0; - element[count] = in; +:void collection_int::alloc() { + if (!buf) { + buf_size = 4096; + buf = malloc(4096); + } else { + buf_size += 4096; + buf = realloc(buf, buf_size); + } +} + +:void collection_int::add(dword _in) { + if (!buf) || (count * sizeof(dword) >= buf_size) alloc(); + EAX = count * sizeof(dword) + buf; + ESDWORD[EAX] = _in; count++; - return 1; } :dword collection_int::get(dword pos) { if (pos<0) || (pos>=count) return 0; - return element[pos]; + return ESDWORD[pos * sizeof(dword) + buf]; } :dword collection_int::get_last() { - return element[count]; + return get(count-1); } :void collection_int::pop() { @@ -124,8 +136,7 @@ struct collection_int } :void collection_int::drop() { - element[0] = - count = 0; + element[0] = count = 0; } #endif \ No newline at end of file