Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 4631 → Rev 4835

/programs/fs/fspeed/build_en.bat
0,0 → 1,6
@erase lang.inc
@echo lang fix en >lang.inc
@fasm fspeed.asm fspeed
@kpack fspeed
@erase lang.inc
@pause
/programs/fs/fspeed/build_ru.bat
0,0 → 1,6
@erase lang.inc
@echo lang fix ru >lang.inc
@fasm fspeed.asm fspeed
@kpack fspeed
@erase lang.inc
@pause
/programs/fs/fspeed/fspeed.asm
0,0 → 1,245
;*****************************************************************************
; File Speed - for Kolibri OS
; Copyright (c) 2014, Marat Zakiyanov aka Mario79, aka Mario
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; * Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; * Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
; * Neither the name of the <organization> nor the
; names of its contributors may be used to endorse or promote products
; derived from this software without specific prior written permission.
;
; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY
; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
; DISCLAIMED. IN NO EVENT SHALL <copyright holder> BE LIABLE FOR ANY
; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
;*****************************************************************************
;-----------------------------------------------------------------------------
use32
org 0x0
db 'MENUET01'
dd 0x01
dd START
dd IM_END
dd I_END
dd STACK_TOP
dd 0x0
dd cur_dir_path
;-----------------------------------------------------------------------------
include 'lang.inc'
include '../../macros.inc'
define __DEBUG__ 1
define __DEBUG_LEVEL__ 1
include '../../debug-fdo.inc'
include '../../develop/libraries/box_lib/load_lib.mac'
@use_library
;-----------------------------------------------------------------------------
START:
DEBUGF 1,'FSPEED: start of programm\n'
;-----------------------------------------------------------------------------
mcall 68,11
test eax,eax
jz exit
;-----------------------------------------------------------------------------
load_libraries l_libs_start,end_l_libs
;if return code =-1 then exit, else nornary work
inc eax
test eax,eax
jz exit
;-----------------------------------------------------------------------------
;OpenDialog initialisation
push dword OpenDialog_data
call [OpenDialog_Init]
;-----------------------------------------------------------------------------
red:
call draw_window
;-----------------------------------------------------------------------------
still:
mcall 10
cmp eax,1
je red
 
cmp eax,2
je key
 
cmp eax,3
je button
 
jmp still
;-----------------------------------------------------------------------------
key:
mcall 2
jmp still
;-----------------------------------------------------------------------------
button:
mcall 17
 
cmp ah,2
je select_file
 
cmp ah,3
je testing
 
cmp ah,1
jne still
;--------------------------------------
exit:
mcall -1
;-----------------------------------------------------------------------------
select_file:
; invoke OpenDialog
mov [OpenDialog_data.type],dword 0
push dword OpenDialog_data
call [OpenDialog_Start]
cmp [OpenDialog_data.status],1
jne still
; prepare for PathShow
push dword PathShow_data
call [PathShow_prepare]
 
call draw_PathShow
jmp still
;-----------------------------------------------------------------------------
draw_PathShow:
mcall 13,<5,400-20>,<5,15>,0xffffff
; draw for PathShow
push dword PathShow_data
call [PathShow_draw]
ret
;-----------------------------------------------------------------------------
draw_window:
mcall 48,3,app_colours,4*10 ; get current colors
 
mcall 12,1
xor esi,esi
xor ebp,ebp
mov edx,[w_work] ; color of work area RRGGBB,8->color
or edx,0x34000000
mcall 0,<100,400>,<100,270>,,,title
call draw_PathShow
mcall 8,<5,80>,<25,15>,2,[w_work_button]
mcall 4,<5+10,25+4>,[w_work_button_text],s_text,s_text.size
mcall 8,<400-65,50>,<25,15>,3,[w_work_button]
mcall 4,<400-65+10,25+4>,[w_work_button_text],r_text,r_text.size
mov ebx,5 shl 16+47
mov ebp,result_table
mov ecx,18
;--------------------------------------
@@:
push ecx
mov ecx,[w_work_text]
or ecx,0x80000000
mcall 4,,,[ebp]
push ebx
mov edx,ebx
add edx,50 shl 16
mov ebx,0x800a0000
mcall 47,,[ebp+4],,[w_work_text]
pop ebx
add ebx,6+5
add ebp,12
pop ecx
dec ecx
jnz @b
 
mcall 12,2
ret
;-----------------------------------------------------------------------------;-----------------------------------------------------------------------------
testing:
mcall 70,fileinfo
test eax,eax
jz @f
DEBUGF 1,'FSPEED: file not found %s\n',fname
jmp still
;--------------------------------------
@@:
DEBUGF 1,'FSPEED: target file %s\n',fname
mov ebp,result_table
mov ecx,18
;--------------------------------------
@@:
push ecx
call read_chunk
pop ecx
add ebp,12
pusha
call draw_window
popa
dec ecx
jnz @b
 
jmp still
;-----------------------------------------------------------------------------
read_chunk:
mov eax,[file_info+32] ; file size
cmp [ebp+8],eax ; chunk size
jb @f
xor eax,eax
mov [ebp+4],eax ; small file size for current chunk size
ret
;--------------------------------------
@@:
mcall 68,12,[ebp+8] ; chunk size
mov [fileread.return],eax
xor eax,eax
mov [fileread.offset],eax ; zero current offset
mcall 26,9 ; get start time
add eax,1600 ; 16 sec for iterations
mov esi,eax
mov ecx,1
mov eax,[ebp+8] ; chunk size
mov [fileread.size],eax
;--------------------------------------
.loop:
mcall 70,fileread
mcall 26,9 ; check current time
cmp esi,eax
jbe .end
; correct offset
mov edx,[ebp+8] ; chunk size
add [fileread.offset],edx ; current offset
; check offset and file size
mov edx,[file_info+32] ; file size
sub edx,[ebp+8] ; chunk size
cmp [fileread.offset],edx
jbe @f
xor edx,edx
mov [fileread.offset],edx ; zero current offset
;--------------------------------------
@@:
inc ecx
jmp .loop
;--------------------------------------
.end:
mov eax,[ebp+8]
imul eax,ecx
shr eax,10+4
mov [ebp+4],eax ; speed KB/s
DEBUGF 1,'FSPEED: chunk size: %s iterations: %d speed: %d KB/s\n',[ebp],ecx,eax
mcall 68,13,[fileread.return]
ret
;-----------------------------------------------------------------------------
include 'idata.inc'
;-----------------------------------------------------------------------------
IM_END:
;-----------------------------------------------------------------------------
include 'udata.inc'
;-----------------------------------------------------------------------------
I_END:
;-----------------------------------------------------------------------------
/programs/fs/fspeed/idata.inc
0,0 → 1,271
;-----------------------------------------------------------------------------
lsz s_text,\
ru,'‚ë¡®à ä ©« ',\
en,'Select file'
;-----------------------------------------------------------------------------
lsz r_text,\
ru,'ãáª',\
en,'Start'
;-----------------------------------------------------------------------------
title db 'File Speed v0.1',0
;-----------------------------------------------------------------------------
include_debug_strings
;-----------------------------------------------------------------------------
l_libs_start:
 
library01 l_libs system_dir_Boxlib+9, cur_dir_path, library_path, system_dir_Boxlib, \
err_message_found_lib1, head_f_l, Box_lib_import, err_message_import1, head_f_i
 
library02 l_libs system_dir_ProcLib+9, cur_dir_path, library_path, system_dir_ProcLib, \
err_message_found_lib2, head_f_l, ProcLib_import, err_message_import2, head_f_i
 
end_l_libs:
;-----------------------------------------------------------------------------
system_dir_Boxlib db '/sys/lib/box_lib.obj',0
system_dir_ProcLib db '/sys/lib/proc_lib.obj',0
 
head_f_i:
head_f_l db 'System error',0
 
err_message_found_lib1 db 'box_lib.obj - Not found!',0
err_message_found_lib2 db 'proc_lib.obj - Not found!',0
 
err_message_import1 db 'box_lib.obj - Wrong import!',0
err_message_import2 db 'proc_lib.obj - Wrong import!',0
 
;-----------------------------------------------------------------------------
align 4
ProcLib_import:
OpenDialog_Init dd aOpenDialog_Init
OpenDialog_Start dd aOpenDialog_Start
;OpenDialog_Version dd aOpenDialog_Version
 
;ColorDialog_Init dd aColorDialog_Init
;ColorDialog_Start dd aColorDialog_Start
;ColorDialog_Version dd aColorDialog_Version
 
dd 0
dd 0
 
aOpenDialog_Init db 'OpenDialog_init',0
aOpenDialog_Start db 'OpenDialog_start',0
;aOpenDialog_Version db 'Version_OpenDialog',0
 
;aColorDialog_Init db 'ColorDialog_init',0
;aColorDialog_Start db 'ColorDialog_start',0
;aColorDialog_Version db 'Version_ColorDialog',0
;-----------------------------------------------------------------------------
align 4
Box_lib_import:
;init_lib dd a_init
;version_lib dd a_version
 
 
;edit_box_draw dd aEdit_box_draw
;edit_box_key dd aEdit_box_key
;edit_box_mouse dd aEdit_box_mouse
;version_ed dd aVersion_ed
 
;check_box_draw dd aCheck_box_draw
;check_box_mouse dd aCheck_box_mouse
;version_ch dd aVersion_ch
 
;option_box_draw dd aOption_box_draw
;option_box_mouse dd aOption_box_mouse
;version_op dd aVersion_op
 
;scrollbar_ver_draw dd aScrollbar_ver_draw
;scrollbar_ver_mouse dd aScrollbar_ver_mouse
;scrollbar_hor_draw dd aScrollbar_hor_draw
;scrollbar_hor_mouse dd aScrollbar_hor_mouse
;version_scrollbar dd aVersion_scrollbar
 
;dinamic_button_draw dd aDbutton_draw
;dinamic_button_mouse dd aDbutton_mouse
;version_dbutton dd aVersion_dbutton
 
;menu_bar_draw dd aMenu_bar_draw
;menu_bar_mouse dd aMenu_bar_mouse
;menu_bar_activate dd aMenu_bar_activate
;version_menu_bar dd aVersion_menu_bar
 
;FileBrowser_draw dd aFileBrowser_draw
;FileBrowser_mouse dd aFileBrowser_mouse
;FileBrowser_key dd aFileBrowser_key
;Version_FileBrowser dd aVersion_FileBrowser
 
PathShow_prepare dd sz_PathShow_prepare
PathShow_draw dd sz_PathShow_draw
;Version_path_show dd szVersion_path_show
 
;Frame_draw dd sz_Frame_draw
;Version_frame dd szVersion_frame
 
dd 0
dd 0
 
;a_init db 'lib_init',0
;a_version db 'version',0
 
;aEdit_box_draw db 'edit_box',0
;aEdit_box_key db 'edit_box_key',0
;aEdit_box_mouse db 'edit_box_mouse',0
;aVersion_ed db 'version_ed',0
 
;aCheck_box_draw db 'check_box_draw',0
;aCheck_box_mouse db 'check_box_mouse',0
;aVersion_ch db 'version_ch',0
 
;aOption_box_draw db 'option_box_draw',0
;aOption_box_mouse db 'option_box_mouse',0
;aVersion_op db 'version_op',0
 
;aScrollbar_ver_draw db 'scrollbar_v_draw',0
;aScrollbar_ver_mouse db 'scrollbar_v_mouse',0
;aScrollbar_hor_draw db 'scrollbar_h_draw',0
;aScrollbar_hor_mouse db 'scrollbar_h_mouse',0
;aVersion_scrollbar db 'version_scrollbar',0
 
;aDbutton_draw db 'dbutton_draw',0
;aDbutton_mouse db 'dbutton_mouse',0
;aVersion_dbutton db 'version_dbutton',0
 
;aMenu_bar_draw db 'menu_bar_draw',0
;aMenu_bar_mouse db 'menu_bar_mouse',0
;aMenu_bar_activate db 'menu_bar_activate',0
;aVersion_menu_bar db 'version_menu_bar',0
 
;aFileBrowser_draw db 'FileBrowser_draw',0
;aFileBrowser_mouse db 'FileBrowser_mouse',0
;aFileBrowser_key db 'FileBrowser_key',0
;aVersion_FileBrowser db 'version_FileBrowser',0
 
sz_PathShow_prepare db 'PathShow_prepare',0
sz_PathShow_draw db 'PathShow_draw',0
;szVersion_path_show db 'version_PathShow',0
 
;sz_Frame_draw db 'frame_draw',0
;szVersion_frame db 'version_frame',0
;-----------------------------------------------------------------------------
PathShow_data:
.type dd 0 ;+0
.start_y dw 5+4 ;+4
.start_x dw 5+5 ;+6
.font_size_x dw 6 ;+8 ; 6 - for font 0, 8 - for font 1
.area_size_x dw 400-30 ;+10
.font_number dd 0 ;+12 ; 0 - monospace, 1 - variable
.background_flag dd 0 ;+16
.font_color dd 0x0 ;+20
.background_color dd 0x0 ;+24
.text_pointer dd fname ;+28
.work_area_pointer dd text_work_area ;+32
.temp_text_length dd 0 ;+36
;-----------------------------------------------------------------------------
OpenDialog_data:
.type dd 0
.procinfo dd process_info ;+4
.com_area_name dd communication_area_name ;+8
.com_area dd 0 ;+12
.opendir_pach dd temp_dir_pach ;+16
.dir_default_pach dd communication_area_default_pach ;+20
.start_path dd open_dialog_path ;+24
.draw_window dd draw_window ;+28
.status dd 0 ;+32
.openfile_pach dd fname ;+36
.filename_area dd filename_area ;+40
.filter_area dd Filter
.x:
.x_size dw 420 ;+48 ; Window X size
.x_start dw 10 ;+50 ; Window X position
.y:
.y_size dw 320 ;+52 ; Window y size
.y_start dw 10 ;+54 ; Window Y position
 
communication_area_name:
db 'FFFFFFFF_open_dialog2',0
open_dialog_path:
if __nightbuild eq yes
db '/sys/MANAGERS/opendial',0
else
db '/sys/File Managers/opendial',0
end if
 
communication_area_default_pach:
db '/sys',0
 
Filter:
dd Filter.end - Filter.1
.1:
;db 'BIN',0
;db 'DAT',0
.end:
db 0
 
start_temp_file_name:
db 'default.dtp',0
 
default_dtp:
db '/sys/default.dtp',0
;-----------------------------------------------------------------------------
sector equ 512
;--------------------------------------
result_table:
dd a512b, 0, sector*1
dd a1K, 1, sector*2
dd a2K, 2, sector*4
dd a4K, 3, sector*8
dd a8K, 4, sector*16
dd a16K, 5, sector*32
dd a32K, 6, sector*64
dd a64K, 7, sector*128
dd a128K, 8, sector*256
dd a256K, 9, sector*512
dd a512K, 10, sector*1024
dd a1M, 11, sector*2*1024
dd a2M, 12, sector*4*1024
dd a4M, 13, sector*8*1024
dd a8M, 14, sector*16*1024
dd a16M, 15, sector*32*1024
dd a32M, 16, sector*64*1024
dd a64M, -1, sector*128*1024
;-----------------------------------------------------------------------------
a512b db ' 512',0
a1K db ' 1K',0
a2K db ' 2K',0
a4K db ' 4K',0
a8K db ' 8K',0
a16K db ' 16K',0
a32K db ' 32K',0
a64K db ' 64K',0
a128K db '128K',0
a256K db '256K',0
a512K db '512K',0
a1M db ' 1M',0
a2M db ' 2M',0
a4M db ' 4M',0
a8M db ' 8M',0
a16M db ' 16M',0
a32M db ' 32M',0
a64M db ' 64M',0
;-----------------------------------------------------------------------------
align 4
fileinfo:
.subfunction dd 5
.offset dd 0
.offset_1 dd 0
.size dd 0
.return dd file_info
db 0
.name: dd fname
;-----------------------------------------------------------------------------
align 4
fileread:
.subfunction dd 0
.offset dd 0
.offset_1 dd 0
.size dd 0
.return dd process_info
db 0
.name: dd fname
;-----------------------------------------------------------------------------
/programs/fs/fspeed/udata.inc
0,0 → 1,43
;-----------------------------------------------------------------------------
align 4
cur_dir_path:
rb 4096
;-----------------------------------------------------------------------------
library_path:
rb 4096
;-----------------------------------------------------------------------------
temp_dir_pach:
rb 4096
;-----------------------------------------------------------------------------
process_info:
rb 1024
;-----------------------------------------------------------------------------
fname:
rb 4096
;-----------------------------------------------------------------------------
filename_area:
rb 256
;-----------------------------------------------------------------------------
text_work_area:
rb 1024
;-----------------------------------------------------------------------------
file_info:
rb 40
;-----------------------------------------------------------------------------
align 4
app_colours:
w_frame dd ?
w_grab dd ?
w_grab_button dd ?
w_grab_button_text dd ?
w_grab_text dd ?
w_work dd ?
w_work_button dd ?
w_work_button_text dd ?
w_work_text dd ?
w_work_graph dd ?
;-----------------------------------------------------------------------------
align 4
rb 256
STACK_TOP:
;-----------------------------------------------------------------------------
/programs/fs/fspeed
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property