diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index 53af3a695..e6cb6c5ba 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -14,7 +14,7 @@ //===================================================// #include "../lib/kolibri.h" -#include "../lib/file_system.h" +#include "../lib/fs.h" #include "../lib/gui.h" #include "../lib/list_box.h" #include "../lib/menu.h" diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index 5b7a2c42a..7f366fb75 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -10,7 +10,7 @@ #include "../lib/clipboard.h" #include "../lib/strings.h" #include "../lib/mem.h" -#include "../lib/file_system.h" +#include "../lib/fs.h" #include "../lib/gui.h" #include "../lib/list_box.h" #include "../lib/random.h" diff --git a/programs/cmm/kolibrin/kolibrin.c b/programs/cmm/kolibrin/kolibrin.c index bd09cc5a3..83d4fc517 100644 --- a/programs/cmm/kolibrin/kolibrin.c +++ b/programs/cmm/kolibrin/kolibrin.c @@ -1,7 +1,7 @@ #define MEMSIZE 0x9000 #include "..\lib\strings.h" #include "..\lib\mem.h" -#include "..\lib\file_system.h" +#include "..\lib\fs.h" void main() diff --git a/programs/cmm/lib/clipboard.h b/programs/cmm/lib/clipboard.h index e3c242060..74225b08c 100644 --- a/programs/cmm/lib/clipboard.h +++ b/programs/cmm/lib/clipboard.h @@ -8,7 +8,7 @@ #ifndef INCLUDE_FILESYSTEM_H -#include "../lib/file_system.h" +#include "../lib/fs.h" #endif //===================================================// diff --git a/programs/cmm/lib/copyf.h b/programs/cmm/lib/copyf.h index 17cb26100..768c10640 100644 --- a/programs/cmm/lib/copyf.h +++ b/programs/cmm/lib/copyf.h @@ -4,7 +4,7 @@ #print "[include ]\n" #ifndef INCLUDE_FILESYSTEM_H -#include "../lib/file_system.h" +#include "../lib/fs.h" #endif :int copyf(dword from1, in1) diff --git a/programs/cmm/lib/dll.h b/programs/cmm/lib/dll.h index 9b396c663..0841baa88 100644 --- a/programs/cmm/lib/dll.h +++ b/programs/cmm/lib/dll.h @@ -3,7 +3,7 @@ #print "[include ]\n" #ifndef INCLUDE_FILESYSTEM_H -#include "../lib/file_system.h" +#include "../lib/fs.h" #endif #ifdef LANG_RUS diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/fs.h similarity index 87% rename from programs/cmm/lib/file_system.h rename to programs/cmm/lib/fs.h index 8f7f25294..ec0bfa4a5 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/fs.h @@ -1,6 +1,6 @@ #ifndef INCLUDE_FILESYSTEM_H #define INCLUDE_FILESYSTEM_H -#print "[include ]\n" +#print "[include ]\n" #ifndef INCLUDE_DATE_H #include "../lib/date.h" @@ -33,11 +33,6 @@ - - - /////////////////////////// - // Параметры файла // -/////////////////////////// :f70 getinfo_file_70; :dword GetFileInfo(dword file_path, bdvk_struct) { @@ -53,9 +48,6 @@ $int 0x40 } - ///////////////////////////////////// - // Изменение параметров файла // -///////////////////////////////////// :f70 setinfo_file_70; :dword SetFileInfo(dword file_path, bdvk_struct) { @@ -71,9 +63,6 @@ $int 0x40 } - /////////////////////////// - // Запуск программы // -/////////////////////////// :f70 run_file_70; :signed int RunProgram(dword run_path, run_param) { @@ -89,9 +78,6 @@ $int 0x40 } - /////////////////////////// - // Создание папки // -/////////////////////////// :f70 create_dir_70; :int CreateDir(dword new_folder_path) { @@ -107,9 +93,6 @@ $int 0x40 } - //////////////////////////// - // Удаление файла/папки // -//////////////////////////// :f70 del_file_70; :int DeleteFile(dword del_file_path) { @@ -125,9 +108,6 @@ $int 0x40 } - //////////////////////////// - // Прочитать файл // -//////////////////////////// :f70 read_file_70; :int ReadFile(dword offset, data_size, buffer, file_path) { @@ -177,9 +157,6 @@ } - /////////////////////////// - // Прочитать папку // -/////////////////////////// :f70 read_dir_70; :int ReadDir(dword file_count, read_buffer, dir_path) { @@ -195,12 +172,29 @@ $int 0x40 } +:bool dir_exists(dword fpath) +{ + char buf[32]; + if (!ReadDir(0, #buf, fpath)) return true; + return false; +} + +/* + +// This implementation of dir_exists() is faster than +// previous but here virtual folders like +// '/' and '/tmp' are not recognised as FOLDERS +// by GetFileInfo() => BDVK.isfolder attribute :( + :bool dir_exists(dword fpath) { BDVK fpath_atr; if (GetFileInfo(fpath, #fpath_atr) != 0) return false; return fpath_atr.isfolder; } +*/ + + :bool file_exists(dword fpath) { BDVK ReadFile_atr; @@ -306,6 +300,7 @@ enum sprintf(#ConvertSize_size_prefix,"%d %s",bytes,#size_nm); return #ConvertSize_size_prefix; } + :dword ConvertSize64(dword bytes_lo, bytes_hi) { if (bytes_hi > 0) { @@ -315,15 +310,18 @@ enum } else return ConvertSize(bytes_lo); } + :dword notify(dword notify_param) { return RunProgram("/sys/@notify", notify_param); } + :void die(dword _last_msg) { notify(_last_msg); ExitProcess(); } + :unsigned char size[25]=0; :dword ConvertSizeToKb(unsigned int bytes) { diff --git a/programs/cmm/lib/gui.h b/programs/cmm/lib/gui.h index cf1b67150..b5ce4e5c1 100644 --- a/programs/cmm/lib/gui.h +++ b/programs/cmm/lib/gui.h @@ -57,13 +57,13 @@ :int active_button_id = 0; :int DrawStandartCaptButton(dword x, y, id, text) { - int padding_v = 5; - int padding_h = 15; - int right_margin = 12; + #define padding_v 5 + #define padding_h 15 + #define right_margin 12 + #define h padding_v + padding_v + 16 //16 font height int tx = x + padding_h; int ty = y + padding_v+1; int tw = strlen(text)*8; - int h = padding_v + padding_v + 16; //16 font height int w = tw + padding_h + padding_h; diff --git a/programs/cmm/liza/liza.c b/programs/cmm/liza/liza.c index c4c0d43df..87176ccf7 100644 --- a/programs/cmm/liza/liza.c +++ b/programs/cmm/liza/liza.c @@ -7,7 +7,7 @@ #include "../lib/mem.h" #include "../lib/dll.h" #include "../lib/gui.h" -#include "../lib/file_system.h" +#include "../lib/fs.h" #include "../lib/list_box.h" #include "../lib/socket.h" #include "../lib/draw_buf.h" diff --git a/programs/cmm/mousecfg/mousecfg.c b/programs/cmm/mousecfg/mousecfg.c index 76178c304..7c518bd97 100644 --- a/programs/cmm/mousecfg/mousecfg.c +++ b/programs/cmm/mousecfg/mousecfg.c @@ -7,7 +7,7 @@ #define MEMSIZE 0x23E80 #include "..\lib\strings.h" #include "..\lib\mem.h" -#include "..\lib\file_system.h" +#include "..\lib\fs.h" #include "..\lib\gui.h" #include "..\lib\obj\libio.h" #include "..\lib\obj\box_lib.h" diff --git a/programs/cmm/panels_cfg/panels_cfg.c b/programs/cmm/panels_cfg/panels_cfg.c index 75bc59d34..a495bbb0d 100644 --- a/programs/cmm/panels_cfg/panels_cfg.c +++ b/programs/cmm/panels_cfg/panels_cfg.c @@ -6,7 +6,7 @@ #include "..\lib\kolibri.h" #include "..\lib\strings.h" #include "..\lib\mem.h" -#include "..\lib\file_system.h" +#include "..\lib\fs.h" #include "..\lib\dll.h" #include "..\lib\gui.h" diff --git a/programs/cmm/pixie/pixie.c b/programs/cmm/pixie/pixie.c index 198a5c2d5..9e8ca3f9e 100644 --- a/programs/cmm/pixie/pixie.c +++ b/programs/cmm/pixie/pixie.c @@ -9,7 +9,7 @@ char default_dir[] = "/rd/1"; od_filter filter2 = { 8, "MP3\0\0" }; -#include "..\lib\file_system.h" +#include "..\lib\fs.h" #include "..\lib\list_box.h" #include "..\lib\gui.h" diff --git a/programs/cmm/pixie2/pixie.c b/programs/cmm/pixie2/pixie.c index 7b39057ac..1bfd51642 100644 --- a/programs/cmm/pixie2/pixie.c +++ b/programs/cmm/pixie2/pixie.c @@ -6,7 +6,7 @@ // // //===================================================// -#include "../lib/file_system.h" +#include "../lib/fs.h" #include "../lib/list_box.h" #include "../lib/gui.h" #include "../lib/random.h" diff --git a/programs/cmm/taskbar2/Tupfile.lua b/programs/cmm/taskbar2/Tupfile.lua new file mode 100644 index 000000000..bb41347a5 --- /dev/null +++ b/programs/cmm/taskbar2/Tupfile.lua @@ -0,0 +1,6 @@ +if tup.getconfig("NO_CMM") ~= "" then return end +if tup.getconfig("LANG") == "ru" +then C_LANG = "LANG_RUS" +else C_LANG = "LANG_ENG" -- this includes default case without config +end +tup.rule("taskbar2.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "taskbar2.com") diff --git a/programs/cmm/tmpdisk/tmpdisk.c b/programs/cmm/tmpdisk/tmpdisk.c index b814f182c..23a2608a1 100644 --- a/programs/cmm/tmpdisk/tmpdisk.c +++ b/programs/cmm/tmpdisk/tmpdisk.c @@ -2,7 +2,7 @@ #include "..\lib\kolibri.h" #include "..\lib\mem.h" #include "..\lib\strings.h" -#include "..\lib\file_system.h" +#include "..\lib\fs.h" #include "..\lib\dll.h" #include "..\lib\obj\libio.h"