From 9d28bd0e9dd48ec3dc5fbc5a0cee8a75dc3d3881 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sun, 13 Dec 2020 01:21:31 +0000 Subject: [PATCH] decrease c-- app size git-svn-id: svn://kolibrios.org@8383 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/diff/diff.c | 10 +++------- programs/cmm/lib/fs.h | 10 ++++++++++ programs/cmm/lib/kfont.h | 9 ++++----- programs/cmm/menu/menu.c | 1 - programs/cmm/misc/software_widget.c | 3 +-- programs/cmm/sysmon/sysmon.c | 3 +-- 6 files changed, 19 insertions(+), 17 deletions(-) diff --git a/programs/cmm/diff/diff.c b/programs/cmm/diff/diff.c index 014a291e40..5891656484 100644 --- a/programs/cmm/diff/diff.c +++ b/programs/cmm/diff/diff.c @@ -2,10 +2,9 @@ //by den po - jdp@bk.ru #define MEMSIZE 4096 * 60 -#include "../lib/io.h" +#include "../lib/fs.h" #include "../lib/strings.h" #include "../lib/obj/console.h" -IO io1, io2; #define MAX_PATH 260 @@ -92,11 +91,8 @@ console() { char s1; int s2; - srcfile = io1.read(srcfilename); - dstfile = io2.read(dstfilename); - - srcfilesize = io1.FILES_SIZE; - dstfilesize = io2.FILES_SIZE; + read_file(srcfilename, #srcfile, #srcfilesize); + read_file(dstfilename, #dstfile, #dstfilesize); if (!srcfile) die("'First file not found' -E"); if (!dstfile) die("'Second file not found' -E"); diff --git a/programs/cmm/lib/fs.h b/programs/cmm/lib/fs.h index 23d76c0b9b..2c8bcef28f 100644 --- a/programs/cmm/lib/fs.h +++ b/programs/cmm/lib/fs.h @@ -198,6 +198,16 @@ inline fastcall void GetCurDir( ECX, EDX) $int 0x40 } +void read_file(dword path1, buf, size) +{ + EAX = 68; + EBX = 27; + ECX = path1; + $int 0x40; + ESDWORD[size] = EDX; + ESDWORD[buf] = EAX; +} + //===================================================// // // // Misc // diff --git a/programs/cmm/lib/kfont.h b/programs/cmm/lib/kfont.h index 55e58614e9..ff11283738 100644 --- a/programs/cmm/lib/kfont.h +++ b/programs/cmm/lib/kfont.h @@ -21,7 +21,7 @@ #endif #ifndef INCLUDE_IO_H -#include "../lib/io.h" +#include "../lib/fs.h" #endif #include "../lib/patterns/rgb.h" @@ -69,14 +69,13 @@ int kfont_char_width[255]; :bool KFONT::init(dword font_path) { - IO label_io; + dword fsize_notused; if(font)free(font); - label_io.read(font_path); + read_file(font_path, #font_begin, #fsize_notused); if(!EAX) { - label_io.run("/sys/@notify", "'Error: KFONT is not loaded.' -E"); + RunProgram("/sys/@notify", "'Error: KFONT is not loaded.' -E"); return false; } - font_begin = label_io.buffer_data; changeSIZE(); smooth = true; return true; diff --git a/programs/cmm/menu/menu.c b/programs/cmm/menu/menu.c index 9fbd4690db..bc7f51ae42 100644 --- a/programs/cmm/menu/menu.c +++ b/programs/cmm/menu/menu.c @@ -1,7 +1,6 @@ #define MEMSIZE 4096*40 #include "../lib/gui.h" -#include "../lib/io.h" #include "../lib/collection.h" #include "../lib/list_box.h" #include "../lib/fs.h" diff --git a/programs/cmm/misc/software_widget.c b/programs/cmm/misc/software_widget.c index ac2bce5ef4..5ae658f55f 100644 --- a/programs/cmm/misc/software_widget.c +++ b/programs/cmm/misc/software_widget.c @@ -5,7 +5,6 @@ SOFTWARE CENTER v2.86 #define MEMSIZE 4096 * 15 #include "..\lib\strings.h" #include "..\lib\mem.h" -#include "..\lib\io.h" #include "..\lib\gui.h" #include "..\lib\obj\libio.h" @@ -266,7 +265,7 @@ void EventIconClick(dword appid) // }end if (file_exists(#run_app_path)) { - io.run(#run_app_path, param_pos); //0 or offset + RunProgram(#run_app_path, param_pos); //0 or offset if (param_pos) ESBYTE[param_pos - 1] = '|'; } else { notify("'Application not found' -E"); diff --git a/programs/cmm/sysmon/sysmon.c b/programs/cmm/sysmon/sysmon.c index 7dceabdaa9..86748ce585 100644 --- a/programs/cmm/sysmon/sysmon.c +++ b/programs/cmm/sysmon/sysmon.c @@ -16,7 +16,6 @@ // // //===================================================// -#include "../lib/io.h" #include "../lib/gui.h" #include "../lib/fs.h" #include "../lib/list_box.h" @@ -134,7 +133,7 @@ void main() EventKillCurrentProcess(); } if (BTN_ID_PROC_INFO == btn) { - io.run("/sys/tinfo", itoa(GetProcessSlot(current_process_id))); + RunProgram("/sys/tinfo", itoa(GetProcessSlot(current_process_id))); } break; case evReDraw: