From 7506d07dd9a992caafa2f156eafbc27746f46aff Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Sat, 30 Mar 2013 00:52:50 +0000 Subject: [PATCH] Eolite 1.65: dynamic memory allocation for Eolite.ini Installer: serious bug fixed some optimizations git-svn-id: svn://kolibrios.org@3432 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/compile.bat | 2 +- programs/cmm/buildall.bat | 4 +- programs/cmm/eolite/Eolite.c | 14 +++-- programs/cmm/eolite/include/about_dialog.h | 2 +- programs/cmm/eolite/include/ini.h | 34 +++++------- programs/cmm/eolite/txt/ReadMe_en.txt | 14 ++--- programs/cmm/eolite/txt/ReadMe_ru.txt | 9 ++-- programs/cmm/installer/copyf.c | 62 +++------------------- programs/cmm/installer/main.c | 4 +- programs/cmm/lib/file_system.h | 14 +++-- 10 files changed, 53 insertions(+), 106 deletions(-) diff --git a/programs/cmm/browser/compile.bat b/programs/cmm/browser/compile.bat index 79f0e3d1a9..c3b325c807 100644 --- a/programs/cmm/browser/compile.bat +++ b/programs/cmm/browser/compile.bat @@ -1,4 +1,4 @@ -..\C--\c-- HTMLv.c /lst +..\C--\c-- HTMLv.c @del HTMLv @rename HTMLv.com HTMLv @del warning.txt diff --git a/programs/cmm/buildall.bat b/programs/cmm/buildall.bat index 1ad88238d1..022f9091a1 100644 --- a/programs/cmm/buildall.bat +++ b/programs/cmm/buildall.bat @@ -1,7 +1,7 @@ -set BINDIR=C:\Users\111\Desktop\svn\programs\cmm\_bin +set BINDIR=C:\Users\Кирилл\Desktop\cmm\_bin md %BINDIR% cd %BINDIR% -FOR %%A in (*.*) do del \Q "%%A" +rem FOR %%A in (*.*) do del \Q "%%A" cd ..\browser cls diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 566e29533f..9ad2cf9ac4 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -26,8 +26,8 @@ int BUTTON_HEIGHT=18; #define ONLY_OPEN 2 // -#define TITLE "Eolite File Manager v1.64" -#define ABOUT_TITLE "Eolite v1.64" +#define TITLE "Eolite File Manager v1.65" +#define ABOUT_TITLE "Eolite v1.65" dword col_work = 0xE4DFE1; dword col_border = 0x819FC5; dword col_padding = 0xC8C9C9; @@ -62,7 +62,7 @@ char Item[4096]; }; int toolbar_buttons_x[7]={9,46,85,134,167,203}; -char tmp_disk_del_param[3]="d0\0"; +char tmp_disk_del_param[3]="d0"; dword file_mas[6898]; int j, i, mouse_dd; @@ -102,19 +102,17 @@ void main() mem_Init(); if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Error while loading library /rd/1/lib/box_lib.obj"); - SetEventMask(0x27); GetSystemDiscs(); - GetIni(1); - + GetIni(1); if (param) { strcpy(#path, #param); if (strcmp(#path+strlen(#path)-1,"/")<>0) strcat(#path, "/"); // , + "/" } else - strcpy(#path, "/rd/1/"); - + strcpy(#path, "/rd/1/"); Open_Dir(#path,ONLY_OPEN); + SetEventMask(0x27); loop() switch(WaitEvent()) { case evMouse: diff --git a/programs/cmm/eolite/include/about_dialog.h b/programs/cmm/eolite/include/about_dialog.h index 0898f19065..28df23e9f4 100644 --- a/programs/cmm/eolite/include/about_dialog.h +++ b/programs/cmm/eolite/include/about_dialog.h @@ -14,7 +14,7 @@ void about_dialog() id=GetButtonID(); IF (id==1) || (id==10) ExitProcess(); IF (id==23) RunProgram(BROWSER_PATH, BROWSER_LINK); - IF (id==33) RunProgram(EDITOR_PATH, #program_path); + IF (id==33) RunProgram(EDITOR_PATH, abspath("Eolite.ini")); break; case evKey: diff --git a/programs/cmm/eolite/include/ini.h b/programs/cmm/eolite/include/ini.h index 6ed046e807..ae952e8d1a 100644 --- a/programs/cmm/eolite/include/ini.h +++ b/programs/cmm/eolite/include/ini.h @@ -15,7 +15,7 @@ unsigned char *ERROR_TEXT[]={ "Error #5 - File or folder not found", "Error #6 - End of file, EOF", "Error #7 - Pointer lies outside of application memory", -"Error #8 - FAT table is destroyed", +"Error #8 - Too less disk space", "Error #9 - FAT table is destroyed", "Error #10 - Access denied", "Error #11 - Device error", @@ -36,13 +36,7 @@ void GetIni(byte onload) if (onload==1) { free(buff); - buff = malloc(12000); - program_path[strrchr(#program_path, '/')] = NULL; - strcat(#program_path, "Eolite.ini"); - ReadFile(0, 12000, buff, #program_path); - fsize=EBX; - IF (EAX<>6) ReadFile(0, 12000, buff, "/sys/File managers/Eolite.ini"); - IF (EAX<>6) notify("Eolite.ini not found. Defaults will be used."); + if (!GetFile(#buff, #fsize, abspath("Eolite.ini"))) notify("Eolite.ini not found. Defaults will be used."); } // for (tj=0; tj='0') && (ch<='9')) ch -= '0'; - IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; - IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; - color = color*0x10 + ch; - } - return color; + dword color; + char j, ch; + + FOR (j=0; j<6; j++) + { + ch=ESBYTE[htmlcolor+j]; + IF ((ch>='0') && (ch<='9')) ch -= '0'; + IF ((ch>='A') && (ch<='F')) ch -= 'A'-10; + IF ((ch>='a') && (ch<='f')) ch -= 'a'-10; + color = color*0x10 + ch; + } + return color; } \ No newline at end of file diff --git a/programs/cmm/eolite/txt/ReadMe_en.txt b/programs/cmm/eolite/txt/ReadMe_en.txt index 884424ae41..ddbc7b4eb2 100644 --- a/programs/cmm/eolite/txt/ReadMe_en.txt +++ b/programs/cmm/eolite/txt/ReadMe_en.txt @@ -7,26 +7,20 @@ You can find more information here: http://board.kolibrios.org/viewtopic.php?f=9&t=973 -==Install== -Put box_lib.obj into "/sys/lib/" directory. -Put Eolite.ini into programs directory or in "/sys/File Managers/". -Eolite can be opened from anywhere. - - ==Authors== Leency - programming and design. Veliant - programming and support. Inactive now. +lev + +Nable ==Thanks== diamond - -Nable Mario79 Rock_maniak_forever turbanoff -Sorcerer +SoUrcerer Gluk -lev KolibriOS Forever! \ No newline at end of file diff --git a/programs/cmm/eolite/txt/ReadMe_ru.txt b/programs/cmm/eolite/txt/ReadMe_ru.txt index 3833e3d13a..5ea5459010 100644 --- a/programs/cmm/eolite/txt/ReadMe_ru.txt +++ b/programs/cmm/eolite/txt/ReadMe_ru.txt @@ -11,21 +11,22 @@ http://board.kolibrios.org/viewtopic.php?f=9&t=973 ==== box_lib.obj. Eolite.ini - "/sys/File Managers/". + . ==== Leency - , . Veliant - , . + - EditBox . +lev - . +Nable - . + ==== diamond - , . - - EditBox . -Nable - , IPC. Mario79 - . S1n - lib_ini ( ). Rock_maniak_forever, turbanoff, Sorcerer, Gluk, Albom - . -lev - . ! ! KolibriOS Forever! \ No newline at end of file diff --git a/programs/cmm/installer/copyf.c b/programs/cmm/installer/copyf.c index bc7acb329f..e3fc657739 100644 --- a/programs/cmm/installer/copyf.c +++ b/programs/cmm/installer/copyf.c @@ -2,18 +2,18 @@ // относительный путь относительно программы void copyf(dword params) -{ - //copyf /sys/lib|/sys/lib2 +{ + //copyf: /sys/lib|/sys/lib2 char from[4096], to[4096]; BDVK from_atr; int border; - mem_Init(); + if (!params) { notify("Error: no copyf params!"); return; } - program_path[strrchr(#program_path, '/')] = 0x0; + //ищем разделитель border = strchr(params, '|'); if (!border) border = strchr(params, ' '); - if (ESBYTE[params]<>'/') + if (ESBYTE[params]<>'/') //абсолютный путь? { strcpy(#from, #program_path); strcat(#from, params); @@ -28,13 +28,9 @@ void copyf(dword params) GetFileInfo(#from, #from_atr); if (TestBit(from_atr.attr, 4)==1) - { CopyFolder(#from, #to); - } - else - { + else CopyFile(#from, #to); - } } @@ -46,7 +42,7 @@ void CopyFolder(dword from, to) char from2[4096], to2[4096]; error = GetDir(#dirbuf, #fcount, from); - if (error) debug_error(from, error); + if (error) { debug_error(from, error); return; } if ((strcmp(to, "/sys")!=0) && (strcmp(to, "/tmp9/1")!=0)) { @@ -102,7 +98,7 @@ unsigned char *ERROR_TEXT[]={ "Error #5 - File or folder not found", "Error #6 - End of file, EOF", "Error #7 - Pointer lies outside of application memory", -"Error #8 - Too less disk space or FAT table is destroyed", +"Error #8 - Too less disk space", "Error #9 - FAT table is destroyed", "Error #10 - Access denied", "Error #11 - Device error", @@ -129,45 +125,3 @@ void debug_error(int path, error_number) } debug(#error); } - -/* -int files_num; -void CalculateFilesNumber(dword from) -{ - dword dirbuf, fcount, filename; - int i, isdir, error; - char from2[4096]; - - error = GetDir(#dirbuf, #fcount, from); - if (error) debug_error(from, error); - debugi(fcount); - - for (i=0; i