bugfix a macros load_lib.mac

git-svn-id: svn://kolibrios.org@1068 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Alexey Teplov ( 2009-05-08 17:45:28 +00:00
parent a730579b19
commit ea836f1026
8 changed files with 915 additions and 615 deletions

View File

@ -18,49 +18,65 @@ include 'menubar.mac' ;
;---------------------------------------------------- ;----------------------------------------------------
;EditBox ;EditBox
;---------------------------------------------------- ;----------------------------------------------------
align 4
use_editbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . use_editbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
align 4
use_editbox_key ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì. use_editbox_key ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ª« ¢¨èì.
align 4
use_editbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. use_editbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;---------------------------------------------------- ;----------------------------------------------------
;CheckBox ;CheckBox
;---------------------------------------------------- ;----------------------------------------------------
align 4
use_checkbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . use_checkbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
align 4
use_checkbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. use_checkbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;-------------------------------------------------- ;--------------------------------------------------
;radiobutton Group ;radiobutton Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá  ) use_optionbox_driver ;¬ ªà®áë ª®â®àë¥ ã¯à ¢«ïîâ à ¡®â®© ¡®ªá  )
align 4
use_optionbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá . use_optionbox_draw ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®â®¡à ¦¥­¨ï ¡®ªá .
align 4
use_optionbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨. use_optionbox_mouse ;¬ ªà®á à ááªà뢠¥â äã­ªæ¨î ®¡à ¡®âª¨ ¬ëè¨.
;-------------------------------------------------- ;--------------------------------------------------
;scrollbar Group ;scrollbar Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_scroll_bar use_scroll_bar
align 4
use_scroll_bar_vertical use_scroll_bar_vertical
align 4
use_scroll_bar_horizontal use_scroll_bar_horizontal
;-------------------------------------------------- ;--------------------------------------------------
;dinamic button Group ;dinamic button Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_dinamic_button use_dinamic_button
;-------------------------------------------------- ;--------------------------------------------------
;menubar Group ;menubar Group
;-------------------------------------------------- ;--------------------------------------------------
align 4
use_menu_bar use_menu_bar
;-------------------------------------------------- ;--------------------------------------------------
init: init:
ret ret
;;;;;;;;;;;
;;Data
;;;;;;;;;;;
align 4
mouse_flag dd 0x0
align 16 align 16
EXPORTS: EXPORTS:
@ -68,24 +84,30 @@ EXPORTS:
dd sz_init, init dd sz_init, init
dd sz_version, 0x00000001 dd sz_version, 0x00000001
dd sz_edit_box, edit_box dd sz_edit_box, edit_box
dd sz_edit_box_key, edit_box_key dd sz_edit_box_key, edit_box_key
dd sz_edit_box_mouse, edit_box_mouse dd sz_edit_box_mouse, edit_box_mouse
dd szVersion_ed, 0x00000001 dd szVersion_ed, 0x00000001
dd sz_check_box_draw, check_box_draw dd sz_check_box_draw, check_box_draw
dd sz_check_box_mouse, check_box_mouse dd sz_check_box_mouse, check_box_mouse
dd szVersion_ch, 0x00000001 dd szVersion_ch, 0x00000001
dd sz_option_box_draw, option_box_draw dd sz_option_box_draw, option_box_draw
dd sz_option_box_mouse, option_box_mouse dd sz_option_box_mouse, option_box_mouse
dd szVersion_op, 0x00000001 dd szVersion_op, 0x00000001
dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw dd sz_Scrollbar_ver_draw, scroll_bar_vertical.draw
dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse dd sz_Scrollbar_ver_mouse, scroll_bar_vertical.mouse
dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw dd sz_Scrollbar_hor_draw, scroll_bar_horizontal.draw
dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse dd sz_Scrollbar_hor_mouse, scroll_bar_horizontal.mouse
dd szVersion_scrollbar, 0x00010001 dd szVersion_scrollbar, 0x00010001
dd sz_Dbutton_draw, dinamic_button.draw dd sz_Dbutton_draw, dinamic_button.draw
dd sz_Dbutton_mouse, dinamic_button.mouse dd sz_Dbutton_mouse, dinamic_button.mouse
dd szVersion_dbutton, 0x00010001 dd szVersion_dbutton, 0x00010001
dd sz_Menu_bar_draw, menu_bar.draw dd sz_Menu_bar_draw, menu_bar.draw
dd sz_Menu_bar_mouse, menu_bar.mouse dd sz_Menu_bar_mouse, menu_bar.mouse
dd szVersion_menu_bar, 0x00010001 dd szVersion_menu_bar, 0x00010001
@ -94,30 +116,31 @@ EXPORTS:
sz_init db 'lib_init',0 sz_init db 'lib_init',0
sz_version db 'version',0 sz_version db 'version',0
sz_edit_box db 'edit_box',0 sz_edit_box db 'edit_box',0
sz_edit_box_key db 'edit_box_key',0 sz_edit_box_key db 'edit_box_key',0
sz_edit_box_mouse db 'edit_box_mouse',0 sz_edit_box_mouse db 'edit_box_mouse',0
szVersion_ed db 'version_ed',0 szVersion_ed db 'version_ed',0
sz_check_box_draw db 'check_box_draw',0 sz_check_box_draw db 'check_box_draw',0
sz_check_box_mouse db 'check_box_mouse',0 sz_check_box_mouse db 'check_box_mouse',0
szVersion_ch db 'version_ch',0 szVersion_ch db 'version_ch',0
sz_option_box_draw db 'option_box_draw',0 sz_option_box_draw db 'option_box_draw',0
sz_option_box_mouse db 'option_box_mouse',0 sz_option_box_mouse db 'option_box_mouse',0
szVersion_op db 'version_op',0 szVersion_op db 'version_op',0
sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0 sz_Scrollbar_ver_draw db 'scrollbar_v_draw',0
sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0 sz_Scrollbar_ver_mouse db 'scrollbar_v_mouse',0
sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0 sz_Scrollbar_hor_draw db 'scrollbar_h_draw',0
sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0 sz_Scrollbar_hor_mouse db 'scrollbar_h_mouse',0
szVersion_scrollbar db 'version_scrollbar',0 szVersion_scrollbar db 'version_scrollbar',0
sz_Dbutton_draw db 'dbutton_draw',0 sz_Dbutton_draw db 'dbutton_draw',0
sz_Dbutton_mouse db 'dbutton_mouse',0 sz_Dbutton_mouse db 'dbutton_mouse',0
szVersion_dbutton db 'version_dbutton',0 szVersion_dbutton db 'version_dbutton',0
sz_Menu_bar_draw db 'menu_bar_draw',0 sz_Menu_bar_draw db 'menu_bar_draw',0
sz_Menu_bar_mouse db 'menu_bar_mouse',0 sz_Menu_bar_mouse db 'menu_bar_mouse',0
szVersion_menu_bar db 'version_menu_bar',0 szVersion_menu_bar db 'version_menu_bar',0
;;;;;;;;;;;
;;Data
;;;;;;;;;;;
align 16
mouse_flag dd 0x0

View File

@ -41,10 +41,10 @@
dd path dd path
include 'MACROS.INC' include 'MACROS.INC'
include 'load_lib.mac'
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- Start of program ---------------------------------------------- ;--- Start of program ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
START: START:
mcall 68, 11 mcall 68, 11
mcall 66, 1, 1 mcall 66, 1, 1
@ -56,31 +56,37 @@ START:
mov [menu_data_2.procinfo],eax mov [menu_data_2.procinfo],eax
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; loading Box_Lib library ; loading Box_Lib library
mov ebx,boxlib_name load_libraries l_libs_start,end_l_libs
mov esi,path ;sys_load_library boxlib_name, path, file_name, system_dir, \
mov edi,file_name ;er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i
call copy_path ; test eax,eax
; jnz button.exit
mcall 68,19,file_name ; load of alternative ;----------------------------------old
test eax,eax ; mov ebx,boxlib_name
jnz @f ; mov esi,path
; mov edi,file_name
mcall 68,19,system_dir ; load of sys directory ; call copy_path
test eax,eax ;
jz button.exit ; mcall 68,19,file_name ; load of alternative
@@: ; test eax,eax
call import_boxlib ; jnz @f
;
; mcall 68,19,system_dir ; load of sys directory
; test eax,eax
; jz button.exit
;@@:
; call import_boxlib
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; Load and convert BMP file for DinamicButton ; Load and convert BMP file for DinamicButton
; This procedures use cnv_bmp.obj and this module used only for ; This procedures use cnv_bmp.obj and this module used only for
; demonstration of use DinamicButton ; demonstration of use DinamicButton
; mov ebx,plugin_BMP_name
; mov esi,path
; mov edi,file_name
copy_path plugin_BMP_name,path,file_name
; ;
mov ebx,plugin_BMP_name
mov esi,path
mov edi,file_name
call copy_path
mcall 68,19,file_name mcall 68,19,file_name
test eax,eax test eax,eax
jz button.exit jz button.exit
@ -88,10 +94,25 @@ START:
mov eax,[eax+4] mov eax,[eax+4]
mov [plugin],eax mov [plugin],eax
mov ebx,icons_file_name
mov esi,path ;ïðîâåðêà íà ñêîëüêî óäà÷íî çàãóçèëàñü íàøà ëèáà
mov edi,file_name mov ebp,library01
call copy_path cmp dword [ebp+ll_struc_size-4],0
jnz button.exit
;
; mov ebp,library02
; cmp dword [ebp+ll_struc_size-4],0x2
; jnz button.exit
; mov eax,dword [ebp+36]
; mov eax,[eax+4]
; mov [plugin],eax
; mov ebx,icons_file_name
; mov esi,path
; mov edi,file_name
copy_path icons_file_name,path,file_name
mcall 70, fileinfo mcall 70, fileinfo
@ -344,76 +365,7 @@ draw_cube:
mov bx,30 mov bx,30
mcall 13, , , 0x0 mcall 13, , , 0x0
ret ret
;---------------------------------------------------------------------
copy_path:
xor eax,eax
@@:
cld
lodsb
stosb
test eax,eax
jnz @b
mov esi,edi
@@:
std
lodsb
cmp al,'/'
jnz @b
mov edi,esi
add edi,2
mov esi,ebx
@@:
cld
lodsb
stosb
test eax,eax
jnz @b
ret
;---------------------------------------------------------------------
; Import procedure written by <Lrz>
; Copyright (c) 2008, 2009, <Lrz>
; All rights reserved.
; importing Box_lib entry
import_boxlib:
; initialize import
mov edx, eax
mov esi,myimport
.import_loop:
lodsd
test eax, eax
jz .import_done
push edx
.import_find:
mov ebx, [edx]
test ebx, ebx
jz .exit ;import_not_found
push eax
@@:
mov cl, [eax]
cmp cl, [ebx]
jnz .import_find_next
test cl, cl
jz .import_found
inc eax
inc ebx
jmp @b
.import_find_next:
pop eax
add edx, 8
jmp .import_find
.import_found:
pop eax
mov eax, [edx+4]
mov [esi-4], eax
pop edx
jmp .import_loop
.import_done:
ret
.exit:
add esp,4
jmp button.exit
;---------------------------------------------------------------------
include 'data.inc' include 'data.inc'
include 'w_about.inc' include 'w_about.inc'
IM_END: IM_END:

View File

@ -1,6 +1,7 @@
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ---------------------------------------------- ;--- ÄÀÍÍÛÅ ÏÐÎÃÐÀÌÌÛ ----------------------------------------------
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
@use_library
header_1 db 'Box_lib Control Demo by Mario79',0 header_1 db 'Box_lib Control Demo by Mario79',0
ok_btn db 'Ok',0 ok_btn db 'Ok',0
@ -8,11 +9,35 @@ ok_btn db 'Ok',0
labelt3 db 'About program',0 labelt3 db 'About program',0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
icons_file_name: db 'reload_16x16_8b.bmp',0 icons_file_name: db 'reload_16x16_8b.bmp',0
system_dir1 db '/sys/lib/'
plugin_BMP_name db 'cnv_bmp.obj',0 plugin_BMP_name db 'cnv_bmp.obj',0
boxlib_name db 'box_lib.obj',0
system_dir db '/sys/lib/box_lib.obj',0 system_dir db '/sys/lib/'
boxlib_name db 'box_lib.obj',0
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
;system_path db '/sys/lib/box_lib.obj',0
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ihead_f_i:
ihead_f_l db 'System error',0
er_message_found_lib db 'Sorry I cannot load library box_lib.obj',0
er_message_import db 'Error on load import library box_lib.obj',0
er_message_found_lib2 db 'Sorry I cannot load library cnv_bmp.obj',0
er_message_import2 db 'Error on load import library cnv_bmp.obj',0
align 4
l_libs_start:
library01 l_libs boxlib_name, path, file_name, system_dir, \
er_message_found_lib, ihead_f_l, myimport, er_message_import, ihead_f_i
;library02 l_libs plugin_BMP_name, path, file_name, system_dir1,\
;er_message_found_lib2, ihead_f_l, myimport, er_message_import2, ihead_f_i
end_l_libs:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
fileinfo: fileinfo:
dd 5 dd 5
@ -41,6 +66,9 @@ deflate_unpack dd 0
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
align 4 align 4
myimport: myimport:
init_lib dd a_init
version_lib dd a_version
edit_box_draw dd aEdit_box_draw edit_box_draw dd aEdit_box_draw
edit_box_key dd aEdit_box_key edit_box_key dd aEdit_box_key
@ -71,6 +99,9 @@ version_menu_bar dd aVersion_menu_bar
dd 0 dd 0
dd 0 dd 0
a_init db 'lib_init',0
a_version db 'version',0
aEdit_box_draw db 'edit_box',0 aEdit_box_draw db 'edit_box',0
aEdit_box_key db 'edit_box_key',0 aEdit_box_key db 'edit_box_key',0
aEdit_box_mouse db 'edit_box_mouse',0 aEdit_box_mouse db 'edit_box_mouse',0

View File

@ -13,10 +13,14 @@ use32 ;
include 'macros.inc' include 'macros.inc'
include 'editbox_ex.mac' include 'editbox_ex.mac'
include 'load_lib.mac' include 'load_lib.mac'
@use_library ;use load lib macros
start: start:
;universal load library/librarys ;universal load library/librarys
load_library library_name, cur_dir_path, library_path, system_path, \ sys_load_library library_name, cur_dir_path, library_path, system_path, \
err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
;if return code =-1 then exit, else nornary work
cmp eax,-1
jz exit
mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩ mcall 40,0x27 ;ãáâ ­®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
red_win: red_win:
call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­® call draw_window ;¯¥à¢®­ ç «ì­® ­¥®¡å®¤¨¬® ­ à¨á®¢ âì ®ª­®
@ -94,9 +98,16 @@ draw_window: ;
ret ret
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA ¤ ­­ë¥ ;DATA ¤ ­­ë¥
system_path db '/sys/lib/box_lib.obj',0 ;‚ᥣ¤  ᮡ«î¤ âì ¯®á«¥¤®¢ â¥«ì­®áâì ¢ ¨¬¥­¨.
system_path db '/sys/lib/'
library_name db 'box_lib.obj',0 library_name db 'box_lib.obj',0
err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0 ; …᫨ ¥áâì ¦¥« ­¨¥ ࠧꥤ¨­¨âì, â® ­ã¦­® ¨á¯®«ì§®¢ âì á«¥¤ãîé¨î ª®­áâàãªæ¨î
;system_path db '/sys/lib/box_lib.obj',0
;... «î¡ ï ¯®á«¥¤®¢ â¥«ì­®áâì ¤àã£¨å ª®¬ ­¤ ¨ ®¯à¥¤¥«¥­¨©.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
err_message_found_lib db 'Sorry I cannot load library box_lib.obj',0
head_f_i: head_f_i:
head_f_l db 'System error',0 head_f_l db 'System error',0
err_message_import db 'Error on load import library box_lib.obj',0 err_message_import db 'Error on load import library box_lib.obj',0
@ -152,7 +163,7 @@ option_group1 dd op1 ;㪠
option_group2 dd op12 ;¯à¨«®¦¥­¨¥ option_group2 dd op12 ;¯à¨«®¦¥­¨¥
Option_boxs dd op1,op2,op3,0 Option_boxs dd op1,op2,op3,0
Option_boxs2 dd op11,op12,op13,0 Option_boxs2 dd op11,op12,op13,0
hed db 'BOXs load from lib <Lrz> date 27.09.2007',0 hed db 'BOXs load from lib <Lrz> date 27.04.2009',0
hed_end: hed_end:
rb 256 rb 256
check_text db 'First checkbox' check_text db 'First checkbox'
@ -166,6 +177,8 @@ op_text: ;
.e3: .e3:
ed_buffer rb 100 ed_buffer rb 100
;----------------------- ;-----------------------
;sc system_colors
p_info process_information
cur_dir_path rb 4096 cur_dir_path rb 4096
library_path rb 4096 library_path rb 4096
i_end: i_end:

View File

@ -75,3 +75,4 @@ op_flag_en=10b
.ch_text_length: dd op_text_length ;¤«¨­­  áâப¨ á ᨬ¢®« ¬¨ .ch_text_length: dd op_text_length ;¤«¨­­  áâப¨ á ᨬ¢®« ¬¨
.flags: dd flags+0 ; ä« £¨ .flags: dd flags+0 ; ä« £¨
} }

View File

@ -1,3 +1,4 @@
;08.05.2009 - bugfix
;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory. ;14.04.2009 - a macros for code load library the box_lib.obj from '/sys/lib/' or current dirrectory.
; The macros for load any library/libraries: ; The macros for load any library/libraries:
; Copyright (c) 2009, <Lrz> ; Copyright (c) 2009, <Lrz>
@ -39,113 +40,199 @@
; "I'm sorry,the programm cannot found system library box_lib.obj." ; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
; ;
; ebx,library_name ;
; esi,cur_dir_path
; edi,library_path
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; Macro test_load_library ; Macro sys_load_library
; A first time we must to check own path in current dirrectory the program, where I belive find a system library. ; A first time we must to check own path in current dirrectory the program, where I belive find a system library.
; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/". ; If I cannot found my library, i must to check second way. Second way is system path a "/sys/lib/".
; If we cannot load library, we must show the error message: ; If we cannot load library, we must show the error message:
; "I'm sorry,the programm cannot found system library box_lib.obj." ; "I'm sorry,the programm cannot found system library box_lib.obj."
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." ; "The find was make on 2 ways: /sys/lib/ and current dirrectory."
;
;---------------------------------------------------------------------
; How can I use it?
;---------------------------------------------------------------------
;-Example using single load library
;-universal load library/librarys
;load_library library_name, cur_dir_path, library_path, system_path, \
;err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
;-if return code =-1 then exit, else normally work
; cmp eax,-1
; jz exit
;- Well, if you get
;
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;DATA äàííûå
;Âñåãäà ñîáëþäàòü ïîñëåäîâàòåëüíîñòü â èìåíè.
;system_path db '/sys/lib/'
;library_name db 'box_lib.obj',0
; Åñëè åñòü æåëàíèå ðàçúåäèíèòü, òî íóæíî èñïîëüçîâàòü ñëåäóþùèþ êîíñòðóêöèþ
;system_path db '/sys/lib/box_lib.obj',0
;... ëþáàÿ ïîñëåäîâàòåëüíîñòü äðóãèõ êîìàíä è îïðåäåëåíèé.
;library_name db 'box_lib.obj',0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i ;err_message_found_lib db 'Sorry I cannot found library box_lib.obj',0
;head_f_i:
;head_f_l db 'System error',0
;err_message_import db 'Error on load import library box_lib.obj',0
;myimport:
;
;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
; dd 0
; dd 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
;---------------------------------------------------------------------
macro @use_library
{ {
local end_steep show_err_:
;--------------------------------------------------------------------- local red_win
; loading Box_Lib library local still
local button
local __sc
local start
local ex_lp
local lp
local correction
;/equ
err_message1 equ dword [esp+8]
head1 equ dword [esp+4]
mcall 68,19,system_path ; load of sys directory
__sc.frame equ dword [__sc+0]
__sc.grab equ dword [__sc+4]
__sc.grab_button equ dword [__sc+8]
__sc.grab_button_text equ dword [__sc+12]
__sc.grab_text equ dword [__sc+16]
__sc.work equ dword [__sc+20]
__sc.work_button equ dword [__sc+24]
__sc.work_button_text equ dword [__sc+28]
__sc.work_text equ dword [__sc+32]
__sc.work_graph equ dword [__sc+36]
;local on_x
;local on_y
;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;;
mov eax,48 ;get system color
mov ebx,3
mov ecx,__sc
mov edx,sizeof.system_colors
mcall
;---------------------------------------------------------------------
;get with text imul on 6 pix
xor eax,eax
mov esi,err_message1
mov ecx,30
align 4
lp: lodsb
test eax,eax test eax,eax
jnz end_steep jz ex_lp
add ecx,7
mov ebx,library_name jmp lp
mov esi,cur_dir_path
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
} ex_lp:
mcall 48,5 ;get system window
sub eax,ecx
sub bx,90
shl eax,15
shl ebx,15
mov ax,cx
mov bx,90
mov dword [on_x],eax
mov dword [on_y],ebx
; mov eax,dword [esp+4]
; mov dword [header_xx],eax
; mov eax,dword [esp+8]
; mov dword [message_xx],eax
jmp start
__sc system_colors
on_x dd ?
on_y dd ?
message_xx dd ?
header_xx dd ?
;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;;
start:
mcall 40,0x5 ;set mask on events rewraw window and get id button.
red_win:
;draw_window:
mcall 12,1
xor eax,eax
mov ebx,dword [on_x]
mov ecx,dword [on_y]
mov edx,__sc.work
or edx,0x33000000
mov esi,__sc.grab_text
mov edi,head1
mcall
mov eax,4
mov ebx,(10*65536+25)
mov ecx,__sc.grab_text
or ecx,0x90000000
mov edx,err_message1
mcall
mcall 12,2
align 4
still: ;main loop
mcall 10 ;wait event
dec eax
jz red_win
sub eax,2
jnz still ;go to main loop
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;get id button
test ah,ah ;if in ah 0, then go to still
jz still
or dword [esp+40],-1; modify eax in stack (pushad)
ret
macro test_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
; loading Box_Lib library @library_name equ dword [esp+12]
mov ebx,library_name @cur_dir_path equ dword [esp+8]
mov esi,cur_dir_path @library_path equ dword [esp+4]
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library align 4
@copy_path:
mov ebx,@library_name
mov esi,@cur_dir_path
mov edi,@library_path
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;---------------------------------------------------------------------
}
macro load_libraries library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
;---------------------------------------------------------------------
; loading Box_Lib library
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
mov ebx,library_name
mov esi,cur_dir_path
mov edi,library_path
copy_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
;---------------------------------------------------------------------
}
macro copy_path
{
local copy_path
;---------------------------------------------------------------------
; mov ebx,library_name
; mov esi,cur_dir_path
; mov edi,library_path
copy_path:
xor eax,eax xor eax,eax
cld cld
.lp1: .lp1:
@ -172,37 +259,208 @@ copy_path:
test eax,eax test eax,eax
jnz .lp3 jnz .lp3
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
ret
}
macro sys_load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp exit
align 4
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
exit:
;---------------------------------------------------------------------
}
macro load_library library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, myimport, err_message_import, head_f_i
{
local end_steep
local exit
;---------------------------------------------------------------------
; loading Box_Lib library
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp exit
align 4
end_steep:
import_boxlib myimport, err_message_import, head_f_i ;import
exit:
;---------------------------------------------------------------------
}
macro sys_load_libraries _start,_end
{
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name equ [ebp]
cur_dir_path equ [ebp+4]
library_path equ [ebp+8]
system_path equ [ebp+12]
err_message_found_lib equ [ebp+16]
head_f_l equ [ebp+20]
my_import equ [ebp+24]
err_message_import equ [ebp+28]
head_f_i equ [ebp+32]
adr_load_lib equ dword [ebp+36]
status_lib equ dword [ebp+40]
; show_error_window err_message_found_lib, head_f_l ;show error message /create window
; int 0x40
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
align 4
lp: push ecx
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
or status_lib,0x1 ; status of code - enable error - not found library
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp next
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_boxlib my_import, err_message_import, head_f_i ;import
test eax,eax
jz next
or status_lib,0x2 ; status of code - enable error - import error
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
}
macro load_libraries _start,_end
{
local lp
local end_steep
local next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
library_name equ [ebp]
cur_dir_path equ [ebp+4]
library_path equ [ebp+8]
system_path equ [ebp+12]
err_message_found_lib equ [ebp+16]
head_f_l equ [ebp+20]
my_import equ [ebp+24]
err_message_import equ [ebp+28]
head_f_i equ [ebp+32]
adr_load_lib equ dword [ebp+36]
status_lib equ dword [ebp+40]
mov ebp,_start
mov ecx,((_end-_start)/ll_struc_size)
align 4
lp: push ecx
copy_path library_name, cur_dir_path, library_path ;the macros making way /current pach a program/+ name system library
mcall 68,19,library_path ; load of alternative
test eax,eax
jnz end_steep
mcall 68,19,system_path ; load of sys directory
test eax,eax
jnz end_steep
or status_lib,0x1 ; status of code - enable error - not found library
show_error_window err_message_found_lib, head_f_l ;show error message /create window
jmp next
align 4
end_steep:
mov adr_load_lib,eax ;save adr lib in memory
import_boxlib my_import, err_message_import, head_f_i ;import
test eax,eax
jz next
or status_lib,0x2 ; status of code - enable error - import error
next:
pop ecx
add ebp,ll_struc_size
dec ecx
jnz lp
}
macro copy_path lib_name,dir_path,lib_path
{
pushad ;save all registers
push dword lib_name
push dword dir_path
push dword lib_path
call @copy_path
add esp,12
popad ;restore all registers
} }
macro show_error_window err_message, head macro show_error_window err_message, head
{ { pushad ;save all registers
local red_win push dword err_message
local still push dword head
local button
mcall 40,0x5 ;set mask on events rewraw window and get id button. call show_err_
red_win:
;draw_window:
mcall 12, 1
mcall 0, <0,300>, <0,100>, 0x33AABBCC, 0x805080D0, head
mcall 4, <10,10>, 0x90000000, err_message; _found_lib
mcall 12, 2
align 4
still: ;main loop
mcall 10 ;wait event
dec eax
jz red_win
sub eax,2 add esp,8
jnz still ;go to main loop popad ;restore all registers
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
button:
mcall 17 ;get id button
test ah,ah ;if in ah 0, then go to still
jz still
mcall -1
} }
macro import_boxlib myimport, err_message_import, head_f_i macro import_boxlib myimport, err_message_import, head_f_i
{ {
local import_loop local import_loop
@ -212,7 +470,10 @@ local import_find_next
local import_found local import_found
local import_done local import_done
local exit local exit
local e.exit
local import_not_found
; initialize import ; initialize import
mov edx, eax mov edx, eax
mov esi,myimport mov esi,myimport
import_loop: import_loop:
@ -223,7 +484,7 @@ import_loop:
import_find: import_find:
mov ebx, [ds:edx] mov ebx, [ds:edx]
test ebx, ebx test ebx, ebx
jz exit ;import_not_found jz import_not_found
push eax push eax
lp: lp:
mov cl, [ds:eax] mov cl, [ds:eax]
@ -244,11 +505,29 @@ import_found:
mov [esi-4], eax mov [esi-4], eax
pop edx pop edx
jmp import_loop jmp import_loop
exit: import_not_found:
add esp,4 add esp,4
show_error_window err_message_import, head_f_i ;show error message /create window show_error_window err_message_import, head_f_i ;show error message /create window
jmp e.exit
import_done: import_done:
xor eax,eax
e.exit:
;--------------------------------------------------------------------- ;---------------------------------------------------------------------
} }
ll_struc_size = 44;($-library_name) ; constant size of struct
struc l_libs library_name, cur_dir_path, library_path, system_path, err_message_found_lib, head_f_l, my_import, err_message_import, head_f_i; struct for loading libraries
{
.library_name dd library_name
.cur_dir_path dd cur_dir_path
.library_path dd library_path
.system_path dd system_path
.err_message_found_lib dd err_message_found_lib
.head_f_l dd head_f_l
.my_import dd my_import
.err_message_import dd err_message_import
.head_f_i dd head_f_i
.adr_load_lib dd 0x0
.status_lib dd 0x0 ;status of load library
;
}

View File

@ -10,6 +10,7 @@ EditBox
На данный момент, носит эксперементальный, тестовый характер. На данный момент, носит эксперементальный, тестовый характер.
Библиотеку box_lib.obj нужно поместить в папку с выполняющейся программой editbox_ex, или по адресу /sys/lib/? но тогда нужно подменить путь в файле ini_file на путь к библиотеке Библиотеку box_lib.obj нужно поместить в папку с выполняющейся программой editbox_ex, или по адресу /sys/lib/? но тогда нужно подменить путь в файле ini_file на путь к библиотеке
. Пример сам вычисляет путь к библиотеке, не зависимо от своего месторасположения . Пример сам вычисляет путь к библиотеке, не зависимо от своего месторасположения
08.05.2009 - пофиксены баги общее улучшение кода
15.04.2009 - добавлен макрос load_lib.mac - универсальный для загрузки любой библиотеки/библиотек. 15.04.2009 - добавлен макрос load_lib.mac - универсальный для загрузки любой библиотеки/библиотек.
13.09.2009 - обработка клавишь NUM, Caps,Scroll Lock. При нажатии на них, не происходит отображение символа. 13.09.2009 - обработка клавишь NUM, Caps,Scroll Lock. При нажатии на них, не происходит отображение символа.
24.09.2007 - сделал поддрежку checkbox. Добавил ошибки, программа глючит очень серьезно :( 24.09.2007 - сделал поддрежку checkbox. Добавил ошибки, программа глючит очень серьезно :(

View File

@ -1,6 +1,6 @@
@fasm.exe -m 16384 box_lib.asm @fasm.exe -m 16384 box_lib.asm
@fasm.exe -m 16384 editbox_ex.asm editbox_ex.kex @fasm.exe -m 16834 editbox_ex.asm editbox_ex.kex
@fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex @fasm.exe -m 16384 ctrldemo.asm ctrldemo.kex
REM ..\FASM\kpack.exe editbox_ex REM ..\FASM\kpack.exe editbox_ex
rem @klbrinwin.exe editbox_ex.kex REM @klbrinwin.exe editbox_ex.kex
pause pause