update macros @use_library

git-svn-id: svn://kolibrios.org@8219 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
IgorA 2020-11-18 18:11:43 +00:00
parent a561cc6cd0
commit 4982b912eb
2 changed files with 47 additions and 91 deletions

View File

@ -1,7 +1,3 @@
;13.03.2013 - use @notify
;08.06.2010 - new macros @use_library_mem
;08.05.2009 - bugfix
;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:
; Copyright (c) 2009, <Lrz>
; All rights reserved.
@ -93,7 +89,7 @@
macro @use_library
macro @use_library mem_alloc,mem_free,mem_realloc,dll_load
{
local lp1
local lp2
@ -103,7 +99,10 @@ local lp5
local lp6
local file_name
library_fun_memory_alloc equ 0 ;­¥ ¨á¯®«ì§®¢ âì ¢ ¬ ªà®á å ¯à®¢¥àªã ­  ä㭪樨 'lib_init'
library_fun_memory_alloc equ mem_alloc
library_fun_memory_free equ mem_free
library_fun_memory_realloc equ mem_realloc
library_fun_dll_load equ dll_load
align 4
arrea_xx dd 0
@ -245,11 +244,7 @@ align 4
macro @use_library_mem mem_alloc,mem_free,mem_realloc,dll_load
{
@use_library
library_fun_memory_alloc equ mem_alloc
library_fun_memory_free equ mem_free
library_fun_memory_realloc equ mem_realloc
library_fun_dll_load equ dll_load
@use_library mem_alloc,mem_free,mem_realloc,dll_load
}
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__,point_dir_name__
@ -263,10 +258,10 @@ local i_exit
jnz i_begin
if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0
copy_path library_name__, [32], library_path__,0
else
;the macros making way /current path a program/ + name system library
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__
copy_path library_name__, [32], library_path__,point_dir_name__
end if
mcall 68,19,library_path__ ; load of alternative
test eax,eax
@ -297,10 +292,10 @@ local i_error
local i_exit
if point_dir_name__ eq
copy_path library_name__, cur_dir_path__, library_path__,0
copy_path library_name__, [32], library_path__,0
else
;the macros making way /current path a program/ + name system library
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__
copy_path library_name__, [32], library_path__,point_dir_name__
end if
mcall 68,19,library_path__ ; load of alternative
test eax,eax
@ -341,17 +336,16 @@ local cycle1n
local cycle1e
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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]
point_dir_name__ equ [ebp+36]
adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
library_path__ equ [ebp+4]
system_path__ equ [ebp+8]
err_message_found_lib__ equ [ebp+12]
head_f_l__ equ [ebp+16]
my_import equ [ebp+20]
err_message_import__ equ [ebp+24]
head_f_i__ equ [ebp+28]
point_dir_name__ 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
@ -363,7 +357,7 @@ align 4
jnz end_steep
;the macros making way /current path a program/ + name system library
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__
copy_path library_name__, [32], library_path__,point_dir_name__
mcall 68,19,library_path__ ; load of alternative
test eax,eax
@ -425,17 +419,16 @@ local cycle1n
local cycle1e
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
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]
point_dir_name__ equ [ebp+36]
adr_load_lib equ dword [ebp+40]
status_lib equ dword [ebp+44]
library_path__ equ [ebp+4]
system_path__ equ [ebp+8]
err_message_found_lib__ equ [ebp+12]
head_f_l__ equ [ebp+16]
my_import equ [ebp+20]
err_message_import__ equ [ebp+24]
head_f_i__ equ [ebp+28]
point_dir_name__ 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
@ -444,7 +437,7 @@ align 4
push ecx
;the macros making way /current path a program/ + name system library
copy_path library_name__, cur_dir_path__, library_path__,point_dir_name__
copy_path library_name__, [32], library_path__,point_dir_name__
mcall 68,19,library_path__ ; load of alternative
test eax,eax
@ -573,7 +566,7 @@ import_found:
mov [esi-4], eax ;ª®¯¨à㥬 㪠§ â¥«ì (­  äã­ªæ¨î) ¢ ¯à®£à ¬¬ã, -4 áâ ¢¨¬ ¯®â®¬ã çâ® esi ¡ë«® ᤢ¨­ãâ® ª®¬ ­¤®© lodsd
pop edx ;ãáâ ­ ¢«¨¢ ¥¬ edx ­  ­ ç «® ¡¨¡«¨®â¥ç­ëå ä㭪権
;--- ¯à®¢¥à塞 ᮢ¯ ¤ ¥â «¨ ¨¬ï íªá¯®àâ¨à®¢ ­­®© ä㭪樨 á 'lib_init'
if library_fun_memory_alloc eq 0
if library_fun_memory_alloc eq
else
cmp dword[ebx],'lib_'
jne import_loop
@ -602,11 +595,10 @@ exit:
}
;---------------------------------------------------------------------
ll_struc_size = 48;($-library_name__) ; constant size of struct
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__,point_dir_name; struct for loading libraries
{
.library_name__ dd library_name__ ; ¨¬ï § £à㦠¥¬®© ¡¨¡«¨®â¥ª¨
.cur_dir_path__ dd cur_dir_path__ ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ᮤ¥à¦¨âìáï ¯ãâì ®â ªã¤  ¡ë«  § ¯ã饭  ¯à®£à ¬¬ 
.library_path__ dd library_path__ ; 㪠§ â¥«ì ­  ¡ãä¥à ¢ ª®â®à®¬ ¡ã¤¥â á®ä®à¨¬¨à®¢ ­ ¯ãâì ª ¡¨¡«¨®â¥ª¨, ¥á«¨ ­ã¦­® ¢ëç¨á«¨âì ¯ãâì ¤® «¨¡ë á ¬¥áâ  § ¯ã᪠ ¯à®£à ¬¬ë, ®¡ëç­® ­ã¦­®, ¢ á«ãç ïå, ¥á«¨ «¨¡  à á¯®«®¦¥­  ¢ ⮩ ¦¥ ¯ ¯ª¥
.complete_path dd system_path__ ; ¯ãâì ª®â®àë© ç¥âª® ᮤ¥à¦¨â ¯ãâì

View File

@ -11,8 +11,8 @@ include '../../../develop/libraries/box_lib/load_lib.mac'
;include 'lang.inc'
@use_library_mem mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
hed db 'Life 16.11.20',0 ;¯®¤¯¨áì ®ª­ 
@use_library mem.Alloc,mem.Free,mem.ReAlloc,dll.Load
hed db 'Life 18.11.20',0 ;¯®¤¯¨áì ®ª­ 
run_file_70 FileInfoBlock
image_data dd 0 ;㪠§ â¥«ì ­  ¢à¥¬¥­­ãî ¯ ¬ïâì. ¤«ï ­ã¦¥­ ¯à¥®¡à §®¢ ­¨ï ¨§®¡à ¦¥­¨ï
@ -1663,78 +1663,43 @@ db 0
head_f_i:
head_f_l db '‘¨á⥬­ ï ®è¨¡ª ',0
head_f_l db '"‘¨á⥬­ ï ®è¨¡ª ',0
system_dir_0 db '/sys/lib/'
lib_name_0 db 'proc_lib.obj',0
err_message_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,0
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,0
err_message_found_lib_0 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'proc_lib.obj',39,'" -tE',0
err_message_import_0 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'proc_lib.obj',39,'" -tE',0
system_dir_1 db '/sys/lib/'
lib_name_1 db 'libimg.obj',0
err_message_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,0
err_message_found_lib_1 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'libimg.obj',39,'" -tE',0
err_message_import_1 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'libimg.obj',39,'" -tE',0
system_dir_2 db '/sys/lib/'
lib_name_2 db 'buf2d.obj',0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,0
err_msg_found_lib_2 db '<27>¥ ­ ©¤¥­  ¡¨¡«¨®â¥ª  ',39,'buf2d.obj',39,'" -tE',0
err_msg_import_2 db 'Žè¨¡ª  ¯à¨ ¨¬¯®à⥠¡¨¡«¨®â¥ª¨ ',39,'buf2d',39,'" -tE',0
l_libs_start:
lib0 l_libs lib_name_0, sys_path, file_name, system_dir_0,\
lib0 l_libs lib_name_0, 0, file_name, system_dir_0,\
err_message_found_lib_0, head_f_l, proclib_import,err_message_import_0, head_f_i
lib1 l_libs lib_name_1, sys_path, file_name, system_dir_1,\
lib1 l_libs lib_name_1, 0, file_name, system_dir_1,\
err_message_found_lib_1, head_f_l, import_libimg, err_message_import_1, head_f_i
lib2 l_libs lib_name_2, sys_path, library_path, system_dir_2,\
lib2 l_libs lib_name_2, 0, file_name, system_dir_2,\
err_msg_found_lib_2,head_f_l,import_buf2d,err_msg_import_2,head_f_i
l_libs_end:
align 4
import_libimg:
dd alib_init1
img_is_img dd aimg_is_img
img_info dd aimg_info
img_from_file dd aimg_from_file
img_to_file dd aimg_to_file
img_from_rgb dd aimg_from_rgb
img_to_rgb dd aimg_to_rgb
img_to_rgb2 dd aimg_to_rgb2
img_decode dd aimg_decode
img_encode dd aimg_encode
img_create dd aimg_create
img_destroy dd aimg_destroy
img_destroy_layer dd aimg_destroy_layer
img_count dd aimg_count
img_lock_bits dd aimg_lock_bits
img_unlock_bits dd aimg_unlock_bits
img_flip dd aimg_flip
img_flip_layer dd aimg_flip_layer
img_rotate dd aimg_rotate
img_rotate_layer dd aimg_rotate_layer
img_draw dd aimg_draw
dd 0,0
alib_init1 db 'lib_init',0
aimg_is_img db 'img_is_img',0 ;®¯à¥¤¥«ï¥â ¯® ¤ ­­ë¬, ¬®¦¥â «¨ ¡¨¡«¨®â¥ª  ᤥ« âì ¨§ ­¨å ¨§®¡à ¦¥­¨¥
aimg_info db 'img_info',0
aimg_from_file db 'img_from_file',0
aimg_to_file db 'img_to_file',0
aimg_from_rgb db 'img_from_rgb',0
aimg_to_rgb db 'img_to_rgb',0 ;¯à¥®¡à §®¢ ­¨¥ ¨§®¡à ¦¥­¨ï ¢ ¤ ­­ë¥ RGB
aimg_to_rgb2 db 'img_to_rgb2',0
aimg_decode db 'img_decode',0 ; ¢â®¬ â¨ç¥áª¨ ®¯à¥¤¥«ï¥â ä®à¬ â £à ä¨ç¥áª¨å ¤ ­­ëå
aimg_encode db 'img_encode',0
aimg_create db 'img_create',0
aimg_destroy db 'img_destroy',0
aimg_destroy_layer db 'img_destroy_layer',0
aimg_count db 'img_count',0
aimg_lock_bits db 'img_lock_bits',0
aimg_unlock_bits db 'img_unlock_bits',0
aimg_flip db 'img_flip',0
aimg_flip_layer db 'img_flip_layer',0
aimg_rotate db 'img_rotate',0
aimg_rotate_layer db 'img_rotate_layer',0
aimg_draw db 'img_draw',0
align 4
proclib_import: ;®¯¨á ­¨¥ íªá¯®àâ¨à㥬ëå ä㭪権
@ -1783,8 +1748,7 @@ i_end:
stacktop:
sys_path rb 1024
file_name:
rb 1024 ;4096
library_path rb 1024
rb 2048 ;4096
plugin_path rb 4096
openfile_path rb 4096
filename_area rb 256