/programs/system/MyKey/trunk/ASPAPI.INC |
---|
0,0 → 1,149 |
include 'proc32.inc' |
macro start_draw_window x,y,xsize,ysize,areacolor,caption,capsize |
{ |
;pusha |
mov eax, 12 ; function 12:tell os about windowdraw |
mov ebx, 1 ; 1, start of draw |
int 0x40 |
; DRAW WINDOW |
mov eax, 0 ; function 0 : define and draw window |
mov ebx, x*65536+xsize ; [x start] *65536 + [x size] |
mov ecx, y*65536+ysize ; [y start] *65536 + [y size] |
mov edx, areacolor ; color of work area RRGGBB |
mov esi, 0x00334455 ; color of grab bar RRGGBB |
mov edi, 0x00ddeeff ; color of frames RRGGBB |
int 0x40 |
; WINDOW LABEL |
mov eax, 4 ; function 4 : write text to window |
mov ebx, 8*65536+8 ; [x start] *65536 + [y start] |
mov ecx, 0x00ffffff ; color of text RRGGBB |
mov edx, caption ; pointer to text beginning |
mov esi, capsize ; text length |
int 0x40 |
;popa |
} |
macro end_draw_window |
{ |
mov eax, 12 ; end of redraw |
mov ebx, 2 |
int 0x40 |
} |
macro change_window_place_size x,y,xsize,ysize |
{ |
mov eax, 67 ; function 67 : replace and/or resize window |
mov ebx, x |
mov ecx, y |
mov edx, xsize |
mov esi, ysize |
int 0x40 |
} |
proc draw_button stdcall, x:dword, y:dword, xsize:dword, ysize:dword, \ |
id:dword, butcolor:dword, text:dword, textlen:byte, textcolor:dword |
pusha |
mov ebx, dword [x] |
shl ebx, 16 |
add ebx, dword [xsize] ; [x start] *65536 + [x size] |
mov ecx, dword [y] |
shl ecx, 16 |
add ecx, dword [ysize] ; [y start] *65536 + [y size] |
mov edx, dword [id] ; button id |
mov esi, dword [butcolor] ; button color RRGGBB |
mov eax, 8 ; function 8 : define and draw button |
int 0x40 |
mov ebx, dword [x] |
add ebx, 5 |
shl ebx, 16 |
mov eax, dword [ysize] |
sub eax, 5 |
shr eax, 1 |
add ebx, eax |
add ebx, dword [y] ;mov ebx, (x+5)*65536+y+(ysize-5)/2 ; Draw button text |
mov ecx, dword [textcolor] |
mov edx, dword [text] |
xor eax, eax |
mov al, byte [textlen] |
mov esi, eax |
mov eax, 4 |
int 0x40 |
popa |
ret |
endp |
;macro outtextxy x,y,prompt,prompt_len,color |
;{ |
proc outtextxy stdcall, x:dword, y:dword, prompt:dword, prompt_len:dword, color:dword |
pusha |
mov eax, 4 |
mov ebx, dword [x] ; draw info text with function 4 |
shl ebx, 16 |
or ebx, dword [y] |
mov ecx, dword [color] |
mov edx, dword [prompt] |
mov esi, dword [prompt_len] |
int 0x40 |
popa |
ret |
endp |
;} |
;proc bar x:dword, y:dword, xsize:dword, ysize:dword, color:dword |
macro bar x, y, xsize, ysize, color |
{ |
pusha |
mov eax, 13 |
;mov ebx, [x] |
;shl ebx, 16 |
;add ebx, [xsize] |
;mov ecx, [y] |
;shl ecx, 16 |
;add ecx, [ysize] |
;mov edx, [color] |
mov ebx, x*65536+xsize |
mov ecx, y*65536+ysize |
mov edx, color |
int 0x40 |
popa |
;ret |
;endp |
} |
macro line x1,y1,x2,y2,color |
{ |
pusha |
mov eax, 38 |
mov ebx, x1*65536+x2 |
mov ecx, y1*65536+y2 |
mov edx, color |
int 0x40 |
popa |
} |
macro rectangle x,y,xsize,ysize,color |
{ |
x2=x+xsize |
y2=y+ysize |
line x,y,x2,y,color |
line x,y,x,y2,color |
line x,y2,x2,y2,color |
line x2,y,x2,y2,color |
} |
macro putpixel x,y,color |
{ |
mov eax, 1 |
mov ebx, x |
mov ecx, y |
mov edx, color |
int 0x40 |
} |
/programs/system/MyKey/trunk/MyKey.asm |
---|
0,0 → 1,697 |
; |
; MyKey. Version 0.1. |
; |
; Author: Asper |
; Date of issue: 04.12.2009 |
; Compiler: FASM |
; Target: KolibriOS |
; |
use32 |
org 0x0 |
db 'MENUET00' ; 8 byte id |
dd 38 ; required os |
dd STARTAPP ; program start |
dd I_END ; program image size |
dd 0x1000000 ; required amount of memory |
dd 0x00000000 ; reserved=no extended header |
include "aspAPI.inc" |
include 'macros.inc' |
include 'editbox_ex.mac' |
include 'load_lib.mac' |
include 'debug.inc' |
DEBUG equ 0;1 |
N_KEYCOLOR equ 0x00EEEEEE ; Normal button color |
C_KEYCOLOR equ 0x00CBE1E1 ; Control button color |
A_KEYCOLOR equ 0x000099BB;258778 ; Active button color |
C_TEXTCOLOR equ 0x80000000 ; Button caption color |
CA_TEXTCOLOR equ 0x80FFFFFF ; Active button caption color |
WIN_X equ 265 |
WIN_Y equ 50;175 |
WIN_W equ 595 |
WIN_H equ 415 ;570 |
WIN_COLOR equ 0x04EEEEEE |
BUT_W equ 192;100 |
BUT_H equ 23 |
BUT_SPACE equ 0 |
MAX_HOTKEYS_NUM equ 15 ; Bad bounding :/. Until we have normal listbox control. |
PATH_MAX_CHARS equ 255 |
@use_library |
STARTAPP: |
sys_load_library boxlib_name, sys_path, boxlib_name, system_dir0, err_message_found_lib, head_f_l, myimport,err_message_import, head_f_i |
cmp eax,-1 |
jz close_app |
;mcall 68,11 |
;or eax,eax |
;jz close_app |
mcall 66, 1, 1 ; Set keyboard mode to get scancodes. |
mcall 26, 2, 1, ascii_keymap |
;get_mykey_window_slot_number: |
; mcall 5, 10 ;wait |
; mcall 18, 7 |
; mov [mykey_window], eax |
set_event_mask: |
mcall 40, 39 |
red: |
; .test_slot: |
; mov eax, [mykey_window] ; Test is receiver MyKey window |
; mov ecx, [it_window] |
; cmp eax, ecx |
; je @f;still ; if yes still. |
; .activate_it_window: |
; mov eax, 18 |
; mov ebx, 3 |
; int 0x40 |
; @@: |
call draw_window |
still: |
call reset_modifiers |
mov eax, 10 ; Wait for an event in the queue. |
int 0x40 |
cmp al,1 ; redraw request ? |
jz red |
cmp al,2 ; key in buffer ? |
jz key |
cmp al,3 ; button in buffer ? |
jz button |
cmp al,6 |
jz mouse |
jmp still |
key: |
mov eax, 2 |
int 0x40 |
push eax |
mcall 66, 3 |
mov edx, eax |
and edx, 0x00000FFF |
mov dword [modifiers], edx |
pop eax |
test word [edit1.flags], 10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
jnz .editbox_input |
test word [edit2.flags], 10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
jz @f |
.editbox_input: |
cmp ah, 0x80 ;if key up |
ja still |
cmp ah, 42 ;LShift |
je still |
cmp ah, 54 ;RShift |
je still |
cmp ah, 56 ;Alt |
je still |
cmp ah, 29 ;Ctrl |
je still |
cmp ah, 69 ;Pause/Break |
je still |
; cmp [keyUpr],0 |
; jne still |
call Scan2ASCII |
push dword edit1 |
call [edit_box_key] |
push dword edit2 |
call [edit_box_key] |
jmp still |
@@: |
;------------------------ |
mov cl, byte [hotkeys_num] |
.test_next_hotkey: |
dec cl |
mov bl, cl |
and ebx, 0xFF |
shl ebx, 5 |
mov esi, ebx |
add ebx, dword Hotkeys.codes |
cmp ah, byte [ebx] |
jne @f |
mov edx, dword [ebx] |
shr edx, 8 |
cmp edx, dword [modifiers] |
jne @f |
push eax |
mov eax, PATH_MAX_CHARS |
mul cl |
mov edx, eax |
add edx, dword buf_cmd_params |
add eax, dword buf_cmd_line |
mov esi, eax |
pop eax |
call RunProgram |
jmp .end_test |
@@: |
or cl, cl ;cmp cl, 0 |
jnz .test_next_hotkey ;jge .test_next_hotkey |
.end_test: |
;------------------------ |
jmp still |
button: |
mov eax, 17 ; Get pressed button code |
int 0x40 |
cmp ah, 1 ; Test x button |
je close_app |
cmp ah, 2 |
jne @f |
call AddHotKey |
jmp red |
@@: |
cmp ah, 5 ; Test if pressed buttons |
jb still ; is a HotKey button... |
mov al, ah |
sub al, 5 |
cmp al, byte [hotkeys_num] |
jnb still ; ...so, if not then still, |
mov byte [butt], ah ; if yes then save pressed button ID |
and eax, 0xFF;shr ax, 8 |
if DEBUG |
dps "Button = " |
dph eax |
end if |
mov cl, byte PATH_MAX_CHARS |
mul cl |
if DEBUG |
dps " offset = " |
dph eax |
end if |
mov ebx, eax |
add ebx, dword buf_cmd_params |
add eax, dword buf_cmd_line |
mov dword [edit1.text], eax |
mov dword [edit2.text], ebx |
mov esi, eax |
call strlen |
if DEBUG |
dps " len = " |
dph ecx |
newline |
end if |
mov dword [edit1.size], ecx |
mov dword [edit1.pos], ecx |
mov esi, ebx |
call strlen |
mov dword [edit2.size], ecx |
mov dword [edit2.pos], ecx |
jmp red ;still |
mouse: |
push dword edit1 |
call [edit_box_mouse] |
push dword edit2 |
call [edit_box_mouse] |
;test word [edit1.flags],10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
;jne still |
jmp still |
close_app: |
mov eax,-1 ; close this program |
int 0x40 |
draw_window: |
start_draw_window WIN_X,WIN_Y,WIN_W,WIN_H,WIN_COLOR,labelt, 11;labellen-labelt |
push dword edit1 |
call [edit_box_draw] |
push dword edit2 |
call [edit_box_draw] |
stdcall draw_button, 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText, 0,C_TEXTCOLOR ; Add Hot key. |
if 0 |
stdcall draw_button, 90,WIN_H-30,80,20,3,C_KEYCOLOR,DeleteKeyText,0,C_TEXTCOLOR ; Delete Hot key. |
stdcall draw_button, 173,WIN_H-30,80,20,4,C_KEYCOLOR,ManageKeyText,0,C_TEXTCOLOR ; Manage Hot key. |
end if |
movzx ecx, byte [hotkeys_num] |
cmp ecx, MAX_HOTKEYS_NUM |
jng @f |
mov ecx, MAX_HOTKEYS_NUM |
@@: |
mov eax, 30 |
mov ebx, 5 |
@@: |
or cl, cl |
jz @f |
mov edx, ebx |
sub edx, 5 |
shl edx, 5; edx=edx*32 |
add edx, dword Hotkeys |
cmp bl, byte [butt] |
jne .l1 |
stdcall draw_button, 7,eax,BUT_W,BUT_H,ebx,A_KEYCOLOR,edx,0,CA_TEXTCOLOR ; F5 |
jmp .l2 |
.l1: |
stdcall draw_button, 7,eax,BUT_W,BUT_H,ebx,N_KEYCOLOR,edx,0,C_TEXTCOLOR ; F5 |
.l2: |
add eax, BUT_H+BUT_SPACE |
inc ebx |
dec cl |
jmp @b |
@@: |
end_draw_window |
ret |
AddHotKey: |
mov al, byte [hotkeys_num] |
cmp al, MAX_HOTKEYS_NUM |
jge .end |
inc al |
mov byte [hotkeys_num], al |
mov eax, 51 |
mov ebx, 1 |
mov ecx, start_input_thread |
mov edx, dword input_thread_stack_top |
mcall |
.end: |
ret |
reset_modifiers: |
pusha |
mov esi, dword [it_hotkey_addr] |
test esi, esi |
jz .end_set_mods |
lodsd |
mov cl, al ; set new hotkey |
shr eax, 8 |
xor edx, edx |
push cx |
mov cl, 3 |
.next_pair: |
shl edx, 4 |
mov bl, al |
and bl, 3 |
or bl, bl |
jz .l1 |
cmp bl, 3 ; both? |
jne @f |
or dl, 2 |
jmp .l1 |
@@: |
add bl, 2 |
or dl, bl |
.l1: |
shr eax, 2 |
dec cl |
test cl, cl |
jnz .next_pair |
mov bx, dx |
and bx, 0xF0F |
xchg bl, bh |
and dx, 0x0F0 |
or dx, bx |
pop cx |
mcall 66, 4 |
.end_set_mods: |
popa |
ret |
;######################## Input Thread code start ########################## |
start_input_thread: |
;get_it_window_slot_number: |
; mcall 5, 10 ;wait |
; mcall 18, 7 |
; mov [it_window], eax |
mov ecx, 1 ; to get scancodes. |
mov eax, 66 |
mov ebx, 1 ; Set keyboard mode |
int 0x40 |
mcall 26, 2, 1, ascii_keymap |
mov dword [it_hotkey_addr], 0 |
it_set_editbox: |
mov al, byte [hotkeys_num] |
sub al, 1 |
and eax, 0xFF |
shl eax, 5 |
add eax, dword Hotkeys.names |
mov dword [it_edit.text], eax |
mov esi, eax |
call strlen |
mov dword [it_edit.size], ecx |
mov dword [it_edit.pos], ecx |
it_set_event_mask: |
mcall 40, 39 |
it_red: |
call it_draw_window |
it_still: |
mov eax, 10 ; Wait for an event in the queue. |
int 0x40 |
cmp al,1 ; redraw request ? |
jz it_red |
cmp al,2 ; key in buffer ? |
jz it_key |
cmp al,3 ; button in buffer ? |
jz button |
cmp al,6 |
jz it_mouse |
jmp it_still |
it_key: |
mov eax, 2 |
int 0x40 |
mov byte [it_keycode], 0 |
stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0 |
cmp ah, 0x80 ;if key up |
ja .end |
cmp ah, 42 ;[Shift] (left) |
je .end |
cmp ah, 54 ;[Shift] (right) |
je .end |
cmp ah, 56 ;[Alt] |
je .end |
cmp ah, 29 ;[Ctrl] |
je .end |
cmp ah, 69 ;[Pause Break] |
je .end |
;------------------------ |
mov cl, byte [hotkeys_num] |
.test_next_hotkey: |
mov bl, cl |
and ebx, 0xFF |
shl ebx, 5 |
mov esi, ebx |
add ebx, dword Hotkeys.codes |
cmp ah, byte [ebx] |
jne @f |
push eax |
mov eax, PATH_MAX_CHARS |
mul cl |
add eax, dword buf_cmd_line |
mov esi, eax |
pop eax |
mov edx, 0 ; no parametrs yet <- change it! |
call RunProgram |
jmp .end_test |
@@: |
dec cl |
cmp cl, 0 |
jge .test_next_hotkey |
.end_test: |
;------------------------ |
mov byte [it_keycode], ah |
call Scan2ASCII |
test word [it_edit.flags], 10b;ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬ |
jz .end |
push dword it_edit |
call [edit_box_key] |
jmp it_still |
.end: |
call it_test_key_modifiers |
mov al, byte [it_keycode] |
test al, al |
jz @f |
shl edx, 8 |
mov dl, al |
mov eax, dword [it_hotkey_addr] |
test eax, eax |
jnz @f |
mov al, byte [hotkeys_num] |
sub al, 1 |
and eax, 0xFF |
shl eax, 5 |
add eax, dword Hotkeys.codes |
mov dword [eax], edx |
mov dword [it_hotkey_addr], eax |
mov cl, dl ; finally set hotkey |
shr edx, 8 |
mcall 66, 4 |
@@: |
jmp it_still |
it_test_key_modifiers: |
push eax |
mcall 66, 3 ;get control keys state |
mov edx, eax |
and edx, 0x00000FFF |
.lshift: |
test al, 1 ; LShift ? |
jz .rshift |
stdcall outtextxy, 10, 100, ctrl_key_names, 6, 0x00FF0000 |
.rshift: |
test al, 2 ; RShift ? |
jz .lctrl |
stdcall outtextxy, 184, 100, ctrl_key_names+29, 6, 0x00FF0000 |
.lctrl: |
test al, 4 ; LCtrl ? |
jz .rctrl |
stdcall outtextxy, 52, 100, ctrl_key_names+7, 5, 0x00FF0000 |
.rctrl: |
test al, 8 ; RCtrl ? |
jz .lalt |
stdcall outtextxy, 148, 100, ctrl_key_names+23, 5, 0x00FF0000 |
.lalt: |
test al, 0x10 ; LAlt ? |
jz .ralt |
stdcall outtextxy, 88, 100, ctrl_key_names+13, 4, 0x00FF0000 |
.ralt: |
test al, 0x20 ; RAlt ? |
jz @f |
stdcall outtextxy, 118, 100, ctrl_key_names+18, 4, 0x00FF0000 |
@@: |
pop eax |
ret |
it_mouse: |
push dword it_edit |
call [edit_box_mouse] |
jmp it_still |
it_draw_window: |
start_draw_window WIN_X,WIN_Y+250,225,70,WIN_COLOR,it_labelt, 26;labellen-labelt |
push dword it_edit |
call [edit_box_draw] |
stdcall outtextxy, 10, 100, ctrl_key_names, 35, 0 |
;stdcall draw_button, 7,WIN_H-30,80,20,2,C_KEYCOLOR,AddKeyText, 0,C_TEXTCOLOR ; Add Hot key. |
end_draw_window |
ret |
;######################## Input Thread code end ########################## |
Scan2ASCII: |
push esi |
mov esi, ascii_keymap |
shr eax, 8 |
add esi, eax |
lodsb |
shl eax, 8 |
pop esi |
ret |
;**************************************** |
;* input: esi = pointer to string * |
;* output: ecx = length of the string * |
;**************************************** |
strlen: |
push eax |
xor ecx, ecx |
@@: |
lodsb |
or al, al |
jz @f |
inc ecx |
jmp @b |
@@: |
pop eax |
ret |
;******************************************** |
;* input: esi = pointer to the file name * |
;* edx = pointer to the parametrs * |
;******************************************** |
RunProgram: |
pusha |
mov dword [InfoStructure], 7 ; run program |
mov dword [InfoStructure+4], 0 ; flags |
mov dword [InfoStructure+8], edx ; pointer to the parametrs |
mov dword [InfoStructure+12], 0 ; reserved |
mov dword [InfoStructure+16], 0 ; reserved |
mov dword [InfoStructure+20], 0 ; reserved |
mov dword [InfoStructure+21], esi ; pointer to the file name |
mov eax, 70 |
mov ebx, InfoStructure |
int 0x40 |
cmp eax, 0 |
jl .err_out |
.out: |
popa |
clc |
ret |
.err_out: |
print "Can't load program" |
popa |
stc |
ret |
; DATA AREA |
; Application Title |
labelt db 'MyKey v.0.1' |
;mykey_window dd 0 ; Slot number of MyKey |
;########### Input Thread data start ############ |
; Input Thread Title |
it_labelt db "Input hotkey and it's name" |
;labellen: |
it_edit edit_box 180, 20, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, 31, it_buf_cmd_line, 0, 0 |
it_buf_cmd_line db MAX_HOTKEYS_NUM*32 dup(0) ; !Make it dinamyc!!! |
;it_window dd 0 ; Slot number of Input thread |
it_keycode db 0 |
it_hotkey_addr dd 0 |
;########### Input Thread data end ############ |
;Button names |
AddKeyText db 'Add',0 |
DeleteKeyText db 'Delete',0 |
ManageKeyText db 'Manage',0 |
hotkeys_num db 0;15 |
;keyboard_mode db 0 ; Scan or ASCII keys to send ? 0 - ASCII , 1 - Scan |
butt db 5 ; Pressed button ID |
modifiers dd 0 |
;Data structures for loadlib.mac and editbox_ex.mac [ |
edit1 edit_box 350, 220, 30, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_line, 0, 0 |
edit2 edit_box 350, 220, 50, 0xffffff, 0xAA80, 0x0000ff, 0x0, 0x0, PATH_MAX_CHARS+1, buf_cmd_params, 0, 0 |
buf_cmd_line db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dinamyc!!! |
buf_cmd_params db MAX_HOTKEYS_NUM*PATH_MAX_CHARS dup(0) ; !Make it dinamyc!!! |
sys_path: |
system_dir0 db '/sys/lib/' |
boxlib_name db 'box_lib.obj',0 |
err_message_found_lib db "Can't find box_lib.obj",0 |
head_f_i: |
head_f_l db 'System error',0 |
err_message_import db 'Error on import box_lib.obj',0 |
align 4 |
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 |
dd 0,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 |
;] Data structures for loadlib.mac and editbox_ex.mac |
InfoStructure: |
dd 0x0 ; subfunction number |
dd 0x0 ; position in the file in bytes |
dd 0x0 ; upper part of the position address |
dd 0x0 ; number of bytes to read |
dd 0x0 ; pointer to the buffer to write data |
db 0 |
dd 0 ; pointer to the filename |
I_END: ; End of application code and data marker |
rb 300 ;input thread stack size |
input_thread_stack_top: |
ascii_keymap: |
db 128 dup(?) |
ctrl_key_names db 'LShift LCtrl LAlt RAlt RCtrl RShift',0 |
Hotkeys: ;(name = 32 b) + (modifiers = 3 b) + (keycode = 1 b) = 36 byte for 1 hotkey |
.names: |
db 'My Favorite 1',0 |
rb 18 |
db 'My Favorite 2',0 |
rb 18 |
db 'My Favorite 3',0 |
rb 18 |
rb MAX_HOTKEYS_NUM*32-3 |
.codes: |
dd MAX_HOTKEYS_NUM dup (0) |
/programs/system/MyKey/trunk/ReadMe.txt |
---|
0,0 → 1,51 |
==Î ïðîãðàììå MyKey== |
MyKey - ïðåäíàçíà÷åíà äëÿ áûñòðîãî çàïóñêà ïðîãðàìì íàæàòèåì ñî÷åòàíèé êëàâèø íà êëàâèàòóðå. |
Äëÿ òîãî ÷òîáû äîáàâèòü íîâóþ ãîðÿ÷óþ êëàâèøó: |
1. Íàæìèòå êíîïêó "Add" |
2.  ïîÿâèâøåìñÿ äèàëîãîâîì îêíå ââåäèòå êëàâèøó èëè ñî÷åòàíèå êëàâèøè |
ñ ìîäèôèêàòîðàìè Ctrl, Alt, Shift. |
3. Ââåäèòå íàçâàíèå êëàâèøè. |
4. Ïîñëå ýòîãî çàêðîéòå äèàëîãîâîå îêíî è â îñíîâíîì îêíå âûäåëèòå |
äîáàâëåííóþ êíîïêó. |
5. Â âåðõíåå òåêñòîâîå ïîëå ââåäèòå ïóòü è èìÿ ïðîãðàììû, |
â íèæíåå - ïåðåäàâàåìûå åé ïàðàìåòðû. |
Íåîáõîäèìî ñäåëàòü: |
a. Çàãðóçêà è ñîõðàíåíèå êîíôèãóðàöèîííîãî ôàéëà. |
b. Óäàëåíèå ãîðÿ÷èõ êëàâèø. |
c. Èçìåíåíèå óæå óñòàíîâëåííûõ ãîðÿ÷èõ êëàâèø. |
Íîìåð âåðñèè: 0.1 |
==Àâòîð== |
Asper |
==About program MyKey== |
MyKey - is intended to fast load applications by pressing key combinations |
on the keyboard. |
To add a new hotkey: |
1. Press "Add" button. |
2. In the appeared dialog window input a new key or a key combination |
with Ctrl, Alt, Shift modifiers. |
3. Input key name. |
4. After that close the dialog window and in the main window select |
added button. |
5. In the upper text field input path and name of the program to be executed, |
in the lower text field - parametrs have to be passed to program. |
ToDo: |
a. Load and save of configuration file will be implemented in the next version. |
b. Delete hotkeys. |
c. Change hotkeys that are already set. |
Version number: 0.1 |
==Author== |
Asper |
mailto: asper.85@mail.ru |
/programs/system/MyKey/trunk/config.inc |
---|
0,0 → 1,0 |
__CPU_type fix p5 |
/programs/system/MyKey/trunk/debug.inc |
---|
0,0 → 1,162 |
;include 'kinc/imports.inc' |
macro debug_print str |
{ |
local ..string, ..label |
jmp ..label |
..string db str,0 |
..label: |
pushf |
pushad |
;mov edx,..string |
mov esi, ..string |
;call debug_outstr |
call SysMsgBoardStr |
popad |
popf |
} |
dps fix debug_print |
macro debug_print_dec arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax,arg |
end if |
call debug_outdec |
popad |
popf |
} |
dpd fix debug_print_dec |
;--------------------------------- |
debug_outdec: ;(eax - num, edi-str) |
push 10 ;2 |
pop ecx ;1 |
push -'0' ;2 |
.l0: |
xor edx,edx ;2 |
div ecx ;2 |
push edx ;1 |
test eax,eax ;2 |
jnz .l0 ;2 |
.l1: |
pop eax ;1 |
add al,'0' ;2 |
call debug_outchar ; stosb |
jnz .l1 ;2 |
ret ;1 |
;--------------------------------- |
debug_outchar: ; al - char |
pushf |
pushad |
;mov cl,al |
;mov eax,63 |
;mov ebx,1 |
;int 0x40 |
mov bl, al |
mov eax, 1 |
call SysMsgBoardChar |
popad |
popf |
ret |
;debug_outstr: |
; mov eax,63 |
; mov ebx,1 |
; @@: |
; mov cl,[edx] |
; test cl,cl |
; jz @f |
; int 40h |
; inc edx |
; jmp @b |
; @@: |
; ret |
macro newline |
{ |
dps <13,10> |
} |
macro print message |
{ |
dps message |
newline |
} |
macro pregs |
{ |
dps "EAX: " |
dpd eax |
dps " EBX: " |
dpd ebx |
newline |
dps "ECX: " |
dpd ecx |
dps " EDX: " |
dpd edx |
newline |
} |
macro debug_print_hex arg |
{ |
pushf |
pushad |
if ~arg eq eax |
mov eax, arg |
end if |
call debug_outhex |
popad |
popf |
} |
dph fix debug_print_hex |
debug_outhex: |
; eax - number |
pushf |
pushad |
mov edx, 8 |
.new_char: |
rol eax, 4 |
movzx ecx, al |
and cl, 0x0f |
mov cl, [__hexdigits + ecx] |
pushad |
mcall 63, 1 |
popad |
dec edx |
jnz .new_char |
popad |
popf |
ret |
SysMsgBoardChar: |
mov cl, al |
mov eax, 63 |
mov ebx, 1 |
int 0x40 |
ret |
SysMsgBoardStr: |
push eax |
@@: |
lodsb |
or al, al |
jz @f |
call SysMsgBoardChar |
jmp @b |
@@: |
pop eax |
ret |
__hexdigits: |
db '0123456789ABCDEF' |
/programs/system/MyKey/trunk/editbox_ex.mac |
---|
0,0 → 1,79 |
ed_struc_size=72 |
struc edit_box width,left,top,color,shift_color,focus_border_color,\ |
blur_border_color,text_color,max,text,mouse_variable,flags,size,pos |
{ |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;Bit mask from editbox |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë |
ed_always_focus= 100000000000000b |
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï |
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift |
ed_shift_on_off=1111111111110111b |
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î |
ed_shift_off= 1111111111111011b |
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥ |
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï |
ed_shift_cl= 1111111111100011b |
ed_shift_mcl= 1111111111111011b |
ed_left_fl= 100000b |
ed_right_fl= 1111111111011111b |
ed_offset_fl= 1000000b |
ed_offset_cl= 1111111110111111b |
ed_insert= 10000000b |
ed_insert_cl= 1111111101111111b |
ed_mouse_on = 100000000b |
ed_mous_adn_b= 100011000b |
ed_mouse_on_off=1111111011111111b |
ed_height=14 ; ¢ëá®â |
.width dd width |
.left dd left |
.top dd top |
.color dd color |
.shift_color dd shift_color |
.focus_border_color dd focus_border_color |
.blur_border_color dd blur_border_color |
.text_color dd text_color |
.max dd max |
.text dd text |
.mouse_variable dd mouse_variable |
.flags dd flags+0 |
.size dd size+0 |
.pos dd pos+0 |
.offset dd 0 |
.cl_curs_x dd 0 |
.cl_curs_y dd 0 |
.shift dd 0 |
.shift_old dd 0 |
} |
struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags |
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá |
ch_flag_en=10b |
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å |
.top: dw top ;¯®«®¦¥¨¥ ¯® ã |
.ch_text_margin: dd ch_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨ |
.ch_size: dd ch_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12 |
.color: dd color ;梥⠢ãâਠ祪¡®ªá |
.border_color: dd border_color ;梥â à ¬ª¨ |
.text_color: dd text_color ;梥⠤¯¨á¨ |
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ |
.ch_text_length: dd ch_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨ |
.flags: dd flags+0 ; ä« £¨ |
} |
struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags |
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá |
op_flag_en=10b |
.option_group: dd point_gr |
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å |
.top: dw top ;¯®«®¦¥¨¥ ¯® ã |
.ch_text_margin: dd op_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨ |
.ch_size: dd op_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12 |
.color: dd color ;梥⠢ãâਠ祪¡®ªá |
.border_color: dd border_color ;梥â à ¬ª¨ |
.text_color: dd text_color ;梥⠤¯¨á¨ |
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ |
.ch_text_length: dd op_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨ |
.flags: dd flags+0 ; ä« £¨ |
} |
/programs/system/MyKey/trunk/load_lib.mac |
---|
0,0 → 1,634 |
;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. |
; |
; 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 Alexey Teplov aka <Lrz> ''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. |
;***************************************************************************** |
; This macros based on source code: |
; <Lrz> - Alexey Teplov / Àëåêñåé Òåïëîâ |
; Mario79, Mario - Marat Zakiyanov / Ìàðàò Çàêèÿíîâ |
; Diamondz - Evgeny Grechnikov / Åâãåíèé Ãðå÷íèêîâ |
;------------------------ |
; DESCRIPTION |
; Macro load_library |
; Logick of work. |
; A first time we must to check system path, where I belive find a system library. System path is "/sys/lib/". |
; If I cannot found my library, i must to check second way. Second way is current dirrectory. |
; If we cannot load library, we must show the error message: |
; "I'm sorry,the programm cannot found system library box_lib.obj." |
; "The find was make on 2 ways: /sys/lib/ and current dirrectory." |
; |
; |
;--------------------------------------------------------------------- |
; 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. |
; 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: |
; "I'm sorry,the programm cannot found system library box_lib.obj." |
; "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 |
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
;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 __sc |
local lp |
local lp1 |
local correction |
;local end_tr |
local exit_ |
;/equ |
err_message1 equ dword [esp+8] |
head1 equ dword [esp+4] |
__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] |
;;;;;;;;;;;CALC WIDTH & HIGHT WINDOW & CENTER MONITOR POSITION;;;;;;;;;; |
show_err_: |
;check memory |
push dword [arrea_xx] |
pop eax |
test eax,eax |
jnz @f |
mcall 68,11 |
mcall 68,12,4096 |
push eax |
pop dword [arrea_xx] |
push head1 |
pop dword[eax] |
push 0x0 |
pop dword[eax+4] |
@@: |
mov eax,48 ;get system color |
mov ebx,3 |
mov ecx,__sc |
mov edx,sizeof.system_colors |
mcall |
;----------------------------------- |
xor eax,eax |
mov esi,err_message1 |
mov ecx,30 |
align 4 |
lp: add ecx,7 |
lodsb |
test eax,eax |
jnz lp |
push dword [arrea_xx] |
pop ebp |
align 4 |
@@: add ebp,4 |
mov eax,dword [ebp] |
test eax,eax |
jnz @b |
push err_message1 |
pop dword[ebp] |
mov dword [ebp+4],eax |
mcall 48,5 ;get system window |
cmp word[on_x],cx |
jae @f; íå íóæíî îáíîâëÿòü |
sub eax,ecx |
shl eax,15 |
mov ax,cx |
mov dword [on_x],eax |
@@: |
add word [on_y],12 |
sub bx,word [on_y] |
shl ebx,15 |
mov bx,word [on_y] |
mov dword [on_y],ebx |
ret |
;;;;;;;;;;;DRAW WINDOW;;;;;;;;;;;;;; |
align 4 |
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 ebp,dword [arrea_xx] ; set point |
mov ebx,dword [on_x] |
mov ecx,dword [on_y] |
mov edx,__sc.work |
or edx,0x33000000 |
mov esi,__sc.grab_text |
xor edi,edi |
mov edi,dword [ebp] ;head1 |
mcall |
mov ebx,(10*65536+25-12) |
add ebp,4 ;inc index |
@@: |
mov eax,4 |
add bx,12 |
mov ecx,__sc.grab_text |
or ecx,0x90000000 |
mov edx,dword [ebp] ;err_message1 |
mcall |
add ebp,4 ;inc index |
mov eax,dword [ebp] |
test eax,eax |
jnz @b |
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 |
mcall -1 |
ret |
align 4 |
__sc system_colors |
on_x dd 0x0 |
on_y dd 0x0000004E |
arrea_xx dd 0x0 |
rb 0x50 |
end_tr: |
;--------------------------------------------------------------------- |
@library_name equ dword [esp+12] |
@cur_dir_path equ dword [esp+8] |
@library_path equ dword [esp+4] |
align 4 |
@copy_path: |
mov ebx,@library_name |
mov esi,@cur_dir_path |
mov edi,@library_path |
xor eax,eax |
cld |
.lp1: |
lodsb |
stosb |
test eax,eax |
jnz .lp1 |
mov esi,edi |
std |
.lp2: |
lodsb |
cmp al,'/' |
jnz .lp2 |
mov edi,esi |
mov esi,ebx |
add edi,2 |
cld |
.lp3: |
lodsb |
stosb |
test eax,eax |
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: |
test eax,eax |
jz @f |
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó |
or eax,-1 |
@@: |
;--------------------------------------------------------------------- |
} |
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: |
test eax,eax |
jz @f |
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó |
or eax,-1 |
@@: |
;--------------------------------------------------------------------- |
} |
macro sys_load_libraries _start,_end |
{ |
local exit_lp2 |
local lp2 |
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 |
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 |
;---------------------------------- |
mov ebp,_start |
mov ecx,((_end-_start)/ll_struc_size) |
align 4 |
lp2: |
mov eax,status_lib |
test eax,eax |
jz @f |
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó |
or eax,-1 |
jmp exit_lp2 |
@@: |
add ebp,ll_struc_size |
dec ecx |
jnz lp2 |
exit_lp2: |
} |
macro load_libraries _start,_end |
{ |
local lp2 |
local exit_lp2 |
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 |
;----------------------------------------------- |
mov ebp,_start |
mov ecx,((_end-_start)/ll_struc_size) |
align 4 |
lp2: |
mov eax,status_lib |
test eax,eax |
jz @f |
mcall 51,1,start__,end_tr ; ñîçäàåì íîâûé ïîòîê ïî øàáëîíó |
or eax,-1 |
jmp exit_lp2 |
@@: |
add ebp,ll_struc_size |
dec ecx |
jnz lp2 |
exit_lp2: |
} |
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 |
{ pushad ;save all registers |
push dword err_message |
push dword head |
call show_err_ |
add esp,8 |
popad ;restore all registers |
or eax,-1 ;óâû |
} |
macro import_boxlib myimport, err_message_import__, head_f_i__ |
{ |
local import_loop |
local import_find |
local lp |
local import_find_next |
local import_found |
local import_done |
local exit |
local e.exit |
local import_not_found |
; initialize import |
mov edx, eax |
mov esi,myimport |
import_loop: |
lodsd |
test eax, eax |
jz import_done |
push edx |
import_find: |
mov ebx, [ds:edx] |
test ebx, ebx |
jz import_not_found |
push eax |
lp: |
mov cl, [ds:eax] |
cmp cl, [ds:ebx] |
jnz import_find_next |
test cl, cl |
jz import_found |
inc eax |
inc ebx |
jmp lp |
import_find_next: |
pop eax |
add edx, 8 |
jmp import_find |
import_found: |
pop eax |
mov eax, [ds:edx+4] |
mov [esi-4], eax |
pop edx |
jmp import_loop |
import_not_found: |
add esp,4 |
show_error_window err_message_import__, head_f_i__ ;show error message /create window |
jmp e.exit |
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__ ; óêàçàòåëü íà áóôåð â êîòîðîì áóäåò ñîôîðèìèðîâàí ïóòü ê áèáëèîòåêè, åñëè íóæíî âû÷èñëèòü ïóòü äî ëèáû ñ ìåñòà çàïóñêà ïðîãðàììû, îáû÷íî íóæíî, â ñëó÷àÿõ, åñëè ëèáà ðàñïîëîæåíà â òîé æå ïàïêå |
.complete_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 |
; |
} |
/programs/system/MyKey/trunk/macros.inc |
---|
0,0 → 1,543 |
@^ fix macro comment { |
^@ fix } |
; ------------------------- |
macro library [lname,fname] |
{ |
forward |
dd __#lname#_library_table__,__#lname#_library_name__ |
common |
dd 0 |
forward |
align 4 |
__#lname#_library_name__ db fname,0 |
} |
macro import lname,[name,sname] |
{ |
common |
align 4 |
__#lname#_library_table__: |
forward |
if used name |
name dd __#name#_import_name__ |
end if |
common |
dd 0 |
forward |
if used name |
align 4 |
__#name#_import_name__ db sname,0 |
end if |
} |
macro export [name,sname] |
{ |
forward |
dd __#name#_export_name__,name |
common |
dd 0 |
forward |
align 4 |
__#name#_export_name__ db sname,0 |
} |
; ------------------------- |
macro m2m dest,src { |
push src |
pop dest |
} |
macro iglobal { |
IGlobals equ IGlobals, |
macro __IGlobalBlock { } |
macro uglobal { |
UGlobals equ UGlobals, |
macro __UGlobalBlock { } |
endg fix } ; Use endg for ending iglobal and uglobal blocks. |
macro IncludeIGlobals{ |
macro IGlobals dummy,[n] \{ __IGlobalBlock |
purge __IGlobalBlock \} |
match I, IGlobals \{ I \} } |
macro IncludeUGlobals{ |
macro UGlobals dummy,[n] \{ |
\common |
\local begin, size |
begin = $ |
virtual at $ |
\forward |
__UGlobalBlock |
purge __UGlobalBlock |
\common |
size = $ - begin |
end virtual |
rb size |
\} |
match U, UGlobals \{ U \} } |
uglobal |
endg |
iglobal |
endg |
; new application structure |
macro meos_app_start |
{ |
use32 |
org 0x0 |
db 'MENUET01' |
dd 0x01 |
dd __start |
dd __end |
dd __memory |
dd __stack |
if used __params & ~defined __params |
dd __params |
else |
dd 0x0 |
end if |
dd 0x0 |
} |
MEOS_APP_START fix meos_app_start |
macro code |
{ |
__start: |
} |
CODE fix code |
macro data |
{ |
__data: |
IncludeIGlobals |
} |
DATA fix data |
macro udata |
{ |
if used __params & ~defined __params |
__params: |
db 0 |
__end: |
rb 255 |
else |
__end: |
end if |
__udata: |
IncludeUGlobals |
} |
UDATA fix udata |
macro meos_app_end |
{ |
align 32 |
rb 2048 |
__stack: |
__memory: |
} |
MEOS_APP_END fix meos_app_end |
; macro for defining multiline text data |
struc mstr [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring |
ssize = $ |
end virtual |
dd ssize |
db sstring |
common |
dd -1 |
} |
; macro for defining multiline text data |
struc mls [sstring] |
{ |
forward |
local ssize |
virtual at 0 |
db sstring ; mod |
ssize = $ |
end virtual |
db ssize |
db sstring |
common |
db -1 ; mod |
} |
; strings |
macro sz name,[data] { ; from MFAR [mike.dld] |
common |
if used name |
name db data |
.size = $-name |
end if |
} |
macro lsz name,[lng,data] { ; from MFAR [mike.dld] |
common |
if used name |
label name |
forward |
if lang eq lng |
db data |
end if |
common |
.size = $-name |
end if |
} |
macro szc name,elsz,[data] { ; from MFAR [mike.dld] |
common |
local s,m |
m = 0 |
if used name |
label name |
forward |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
common |
.size = $-name |
.maxl = m |
end if |
} |
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld] |
common |
local s,m,c |
m = 0 |
c = 0 |
if used name |
label name |
forward |
if lang eq lng |
virtual at 0 |
db data |
s = $ |
end virtual |
d#elsz s |
if m < s |
m = s |
end if |
db data |
c = c+1 |
end if |
common |
.size = $-name |
.maxl = m |
.count = c |
end if |
} |
; easy system call macro |
macro mpack dest, hsrc, lsrc |
{ |
if (hsrc eqtype 0) & (lsrc eqtype 0) |
mov dest, (hsrc) shl 16 + lsrc |
else |
if (hsrc eqtype 0) & (~lsrc eqtype 0) |
mov dest, (hsrc) shl 16 |
add dest, lsrc |
else |
mov dest, hsrc |
shl dest, 16 |
add dest, lsrc |
end if |
end if |
} |
macro __mov reg,a,b { ; mike.dld |
if (~a eq)&(~b eq) |
mpack reg,a,b |
else if (~a eq)&(b eq) |
mov reg,a |
end if |
} |
include 'config.inc' |
;__CPU_type equ p5 |
SYSENTER_VAR equ 0 |
macro mcall a,b,c,d,e,f { ; mike.dld, updated by Ghost for Fast System Calls |
local ..ret_point |
__mov eax,a |
__mov ebx,b |
__mov ecx,c |
__mov edx,d |
__mov esi,e |
__mov edi,f |
if __CPU_type eq p5 |
int 0x40 |
else |
if __CPU_type eq p6 |
push ebp |
mov ebp, esp |
push ..ret_point ; it may be 2 or 5 byte |
sysenter |
..ret_point: |
pop edx |
pop ecx |
else |
if __CPU_type eq k6 |
push ecx |
syscall |
pop ecx |
else |
display 'ERROR : unknown CPU type (set to p5)', 10, 13 |
__CPU_type equ p5 |
int 0x40 |
end if |
end if |
end if |
} |
; ------------------------- |
macro header a,[b] { |
common |
use32 |
org 0 |
db 'MENUET',a |
forward |
if b eq |
dd 0 |
else |
dd b |
end if } |
macro section name { align 16 |
label name } |
macro func name { |
if ~used name |
display 'FUNC NOT USED: ',`name,13,10 |
else |
align 4 |
name: |
;diff16 `name,0,name |
;pushad |
;pushfd |
;dps `name |
;newline |
;mcall 5,1 |
;popfd |
;popad |
} |
macro endf { end if } |
macro diff16 title,l1,l2 |
{ |
local s,d |
s = l2-l1 |
display title,': 0x' |
repeat 8 |
d = '0' + s shr ((8-%) shl 2) and $0F |
if d > '9' |
d = d + 'A'-'9'-1 |
end if |
display d |
end repeat |
display 13,10 |
} |
macro diff10 title,l1,l2 |
{ |
local s,d,z,m |
s = l2-l1 |
z = 0 |
m = 1000000000 |
display title,': ' |
repeat 10 |
d = '0' + s / m |
s = s - (s/m)*m |
m = m / 10 |
if d <> '0' |
z = 1 |
end if |
if z <> 0 |
display d |
end if |
end repeat |
display 13,10 |
} |
; optimize the code for size |
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp> |
macro add arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
inc arg1 |
else |
add arg1,arg2 |
end if |
else |
add arg1,arg2 |
end if |
} |
macro sub arg1,arg2 |
{ |
if (arg2 eqtype 0) |
if (arg2) = 1 |
dec arg1 |
else |
sub arg1,arg2 |
end if |
else |
sub arg1,arg2 |
end if |
} |
macro mov arg1,arg2 |
{ |
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0')) |
if (arg2) = 0 |
xor arg1,arg1 |
else if (arg2) = 1 |
xor arg1,arg1 |
inc arg1 |
else if (arg2) = -1 |
or arg1,-1 |
else if (arg2) > -128 & (arg2) < 128 |
push arg2 |
pop arg1 |
else |
mov arg1,arg2 |
end if |
else |
mov arg1,arg2 |
end if |
} |
macro RGB [a] { |
common |
match (r=,g=,b),a \{ |
\dd ((r) shl 16) or ((g) shl 8) or (b) |
\} |
} |
struc POINT _t,_dx,_dy { |
.x _t _dx |
.y _t _dy |
} |
; structure definition helper |
include 'struct.inc' |
struct RECT |
left dd ? |
top dd ? |
right dd ? |
bottom dd ? |
ends |
struct BOX |
left dd ? |
top dd ? |
width dd ? |
height dd ? |
ends |
; structures used in MeOS |
struct process_information |
cpu_usage dd ? ; +0 |
window_stack_position dw ? ; +4 |
window_stack_value dw ? ; +6 |
dw ? ; +8 |
process_name rb 12 ; +10 |
memory_start dd ? ; +22 |
used_memory dd ? ; +26 |
PID dd ? ; +30 |
box BOX ; +34 |
slot_state dw ? ; +50 |
dw ? ; +52 |
client_box BOX ; +54 |
wnd_state db ? ; +70 |
rb (1024-71) |
ends |
struct system_colors |
frame dd ? |
grab dd ? |
grab_button dd ? |
grab_button_text dd ? |
grab_text dd ? |
work dd ? |
work_button dd ? |
work_button_text dd ? |
work_text dd ? |
work_graph dd ? |
ends |
struct FILEDATE |
Second db ? |
Minute db ? |
Hour db ? |
db ? |
Day db ? |
Month db ? |
Year dw ? |
ends |
struct FILEINFO |
Attributes dd ? |
IsUnicode db ? |
db 3 dup(?) |
DateCreate FILEDATE |
DateAccess FILEDATE |
DateModify FILEDATE |
Size dq ? |
ends |
; constants |
; events |
EV_IDLE = 0 |
EV_TIMER = 0 |
EV_REDRAW = 1 |
EV_KEY = 2 |
EV_BUTTON = 3 |
EV_EXIT = 4 |
EV_BACKGROUND = 5 |
EV_MOUSE = 6 |
EV_IPC = 7 |
EV_STACK = 8 |
; event mask bits for function 40 |
EVM_REDRAW = 1b |
EVM_KEY = 10b |
EVM_BUTTON = 100b |
EVM_EXIT = 1000b |
EVM_BACKGROUND = 10000b |
EVM_MOUSE = 100000b |
EVM_IPC = 1000000b |
EVM_STACK = 10000000b |
/programs/system/MyKey/trunk/proc32.inc |
---|
0,0 → 1,268 |
; Macroinstructions for defining and calling procedures |
macro stdcall proc,[arg] ; directly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call proc } |
macro invoke proc,[arg] ; indirectly call STDCALL procedure |
{ common |
if ~ arg eq |
reverse |
pushd arg |
common |
end if |
call [proc] } |
macro ccall proc,[arg] ; directly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call proc |
if size@ccall |
add esp,size@ccall |
end if } |
macro cinvoke proc,[arg] ; indirectly call CDECL procedure |
{ common |
size@ccall = 0 |
if ~ arg eq |
reverse |
pushd arg |
size@ccall = size@ccall+4 |
common |
end if |
call [proc] |
if size@ccall |
add esp,size@ccall |
end if } |
macro proc [args] ; define procedure |
{ common |
match name params, args> |
\{ define@proc name,<params \} } |
prologue@proc equ prologuedef |
macro prologuedef procname,flag,parmbytes,localbytes,reglist |
{ if parmbytes | localbytes |
push ebp |
mov ebp,esp |
if localbytes |
sub esp,localbytes |
end if |
end if |
irps reg, reglist \{ push reg \} } |
epilogue@proc equ epiloguedef |
macro epiloguedef procname,flag,parmbytes,localbytes,reglist |
{ irps reg, reglist \{ reverse pop reg \} |
if parmbytes | localbytes |
leave |
end if |
if flag and 10000b |
retn |
else |
retn parmbytes |
end if } |
macro define@proc name,statement |
{ local params,flag,regs,parmbytes,localbytes,current |
if used name |
name: |
match =stdcall args, statement \{ params equ args |
flag = 11b \} |
match =stdcall, statement \{ params equ |
flag = 11b \} |
match =c args, statement \{ params equ args |
flag = 10001b \} |
match =c, statement \{ params equ |
flag = 10001b \} |
match =params, params \{ params equ statement |
flag = 0 \} |
virtual at ebp+8 |
match =uses reglist=,args, params \{ regs equ reglist |
params equ args \} |
match =regs =uses reglist, regs params \{ regs equ reglist |
params equ \} |
match =regs, regs \{ regs equ \} |
match =,args, params \{ defargs@proc args \} |
match =args@proc args, args@proc params \{ defargs@proc args \} |
parmbytes = $ - (ebp+8) |
end virtual |
name # % = parmbytes/4 |
all@vars equ |
current = 0 |
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \} |
macro locals |
\{ virtual at ebp-localbytes+current |
macro label . \\{ deflocal@proc .,:, \\} |
struc db [val] \\{ \common deflocal@proc .,db,val \\} |
struc dw [val] \\{ \common deflocal@proc .,dw,val \\} |
struc dp [val] \\{ \common deflocal@proc .,dp,val \\} |
struc dd [val] \\{ \common deflocal@proc .,dd,val \\} |
struc dt [val] \\{ \common deflocal@proc .,dt,val \\} |
struc dq [val] \\{ \common deflocal@proc .,dq,val \\} |
struc rb cnt \\{ deflocal@proc .,rb cnt, \\} |
struc rw cnt \\{ deflocal@proc .,rw cnt, \\} |
struc rp cnt \\{ deflocal@proc .,rp cnt, \\} |
struc rd cnt \\{ deflocal@proc .,rd cnt, \\} |
struc rt cnt \\{ deflocal@proc .,rt cnt, \\} |
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \} |
macro endl |
\{ purge label |
restruc db,dw,dp,dd,dt,dq |
restruc rb,rw,rp,rd,rt,rq |
restruc byte,word,dword,pword,tword,qword |
current = $-(ebp-localbytes) |
end virtual \} |
macro ret operand |
\{ match any, operand \\{ retn operand \\} |
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs> |
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \} |
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2 |
end if \} } |
macro defargs@proc [arg] |
{ common |
if ~ arg eq |
forward |
local ..arg,current@arg |
match argname:type, arg |
\{ current@arg equ argname |
label ..arg type |
argname equ ..arg |
if dqword eq type |
dd ?,?,?,? |
else if tbyte eq type |
dd ?,?,? |
else if qword eq type | pword eq type |
dd ?,? |
else |
dd ? |
end if \} |
match =current@arg,current@arg |
\{ current@arg equ arg |
arg equ ..arg |
..arg dd ? \} |
common |
args@proc equ current@arg |
forward |
restore current@arg |
common |
end if } |
macro deflocal@proc name,def,[val] |
{ common |
match vars, all@vars \{ all@vars equ all@vars, \} |
all@vars equ all@vars name |
forward |
local ..var,..tmp |
..var def val |
match =?, val \{ ..tmp equ \} |
match any =dup (=?), val \{ ..tmp equ \} |
match tmp : value, ..tmp : val |
\{ tmp: end virtual |
initlocal@proc ..var,def value |
virtual at tmp\} |
common |
match first rest, ..var, \{ name equ first \} } |
macro initlocal@proc name,def |
{ virtual at name |
def |
size@initlocal = $ - name |
end virtual |
position@initlocal = 0 |
while size@initlocal > position@initlocal |
virtual at name |
def |
if size@initlocal - position@initlocal < 2 |
current@initlocal = 1 |
load byte@initlocal byte from name+position@initlocal |
else if size@initlocal - position@initlocal < 4 |
current@initlocal = 2 |
load word@initlocal word from name+position@initlocal |
else |
current@initlocal = 4 |
load dword@initlocal dword from name+position@initlocal |
end if |
end virtual |
if current@initlocal = 1 |
mov byte [name+position@initlocal],byte@initlocal |
else if current@initlocal = 2 |
mov word [name+position@initlocal],word@initlocal |
else |
mov dword [name+position@initlocal],dword@initlocal |
end if |
position@initlocal = position@initlocal + current@initlocal |
end while } |
macro endp |
{ purge ret,locals,endl |
finish@proc |
purge finish@proc |
restore regs@proc |
match all,args@proc \{ restore all \} |
restore args@proc |
match all,all@vars \{ restore all \} } |
macro local [var] |
{ common |
locals |
forward done@local equ |
match varname[count]:vartype, var |
\{ match =BYTE, vartype \\{ varname rb count |
restore done@local \\} |
match =WORD, vartype \\{ varname rw count |
restore done@local \\} |
match =DWORD, vartype \\{ varname rd count |
restore done@local \\} |
match =PWORD, vartype \\{ varname rp count |
restore done@local \\} |
match =QWORD, vartype \\{ varname rq count |
restore done@local \\} |
match =TBYTE, vartype \\{ varname rt count |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
rq count+count |
restore done@local \\} |
match , done@local \\{ virtual |
varname vartype |
end virtual |
rb count*sizeof.\#vartype |
restore done@local \\} \} |
match :varname:vartype, done@local:var |
\{ match =BYTE, vartype \\{ varname db ? |
restore done@local \\} |
match =WORD, vartype \\{ varname dw ? |
restore done@local \\} |
match =DWORD, vartype \\{ varname dd ? |
restore done@local \\} |
match =PWORD, vartype \\{ varname dp ? |
restore done@local \\} |
match =QWORD, vartype \\{ varname dq ? |
restore done@local \\} |
match =TBYTE, vartype \\{ varname dt ? |
restore done@local \\} |
match =DQWORD, vartype \\{ label varname dqword |
dq ?,? |
restore done@local \\} |
match , done@local \\{ varname vartype |
restore done@local \\} \} |
match ,done@local |
\{ var |
restore done@local \} |
common |
endl } |
/programs/system/MyKey/trunk/struct.inc |
---|
0,0 → 1,180 |
; Macroinstructions for defining data structures |
macro struct name |
{ fields@struct equ name |
match child parent, name \{ fields@struct equ child,fields@\#parent \} |
sub@struct equ |
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \} |
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \} |
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \} |
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \} |
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \} |
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \} |
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \} |
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \} |
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \} |
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \} |
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \} |
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \} |
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \} |
macro db [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,db,<val> \} |
macro dw [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dw,<val> \} |
macro du [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,du,<val> \} |
macro dd [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dd,<val> \} |
macro dp [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dp,<val> \} |
macro dq [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dq,<val> \} |
macro dt [val] \{ \common \local anonymous |
fields@struct equ fields@struct,anonymous,dt,<val> \} |
macro rb count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,db,count dup (?) \} |
macro rw count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dw,count dup (?) \} |
macro rd count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dd,count dup (?) \} |
macro rp count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dp,count dup (?) \} |
macro rq count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dq,count dup (?) \} |
macro rt count \{ \local anonymous |
fields@struct equ fields@struct,anonymous,dt,count dup (?) \} |
macro union \{ fields@struct equ fields@struct,,union,< |
sub@struct equ union \} |
macro struct \{ fields@struct equ fields@struct,,substruct,< |
sub@struct equ substruct \} |
virtual at 0 } |
macro ends |
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt |
restruc rb,rw,rd,rp,rq,rt |
purge db,dw,du,dd,dp,dq,dt |
purge rb,rw,rd,rp,rq,rt |
purge union,struct |
match name=,fields,fields@struct \\{ fields@struct equ |
make@struct name,fields |
fields@\\#name equ fields \\} |
end virtual \} |
match any, sub@struct \{ fields@struct equ fields@struct> \} |
restore sub@struct } |
macro make@struct name,[field,type,def] |
{ common |
if $ |
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah |
err |
end if |
local define |
define equ name |
forward |
local sub |
match , field \{ make@substruct type,name,sub def |
define equ define,.,sub, \} |
match any, field \{ define equ define,.#field,type,<def> \} |
common |
match fields, define \{ define@struct fields \} } |
macro define@struct name,[field,type,def] |
{ common |
local list |
list equ |
forward |
if ~ field eq . |
name#field type def |
sizeof.#name#field = $ - name#field |
else |
rb sizeof.#type |
end if |
local value |
match any, list \{ list equ list, \} |
list equ list <value> |
common |
sizeof.#name = $ |
restruc name |
match values, list \{ |
struc name value \\{ |
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\} |
match , fields@struct \\\{ label . |
forward |
match , value \\\\{ field type def \\\\} |
match any, value \\\\{ field type value |
if ~ field eq . |
rb sizeof.#name#field - ($-field) |
end if \\\\} |
common \\\} \\} \} } |
macro enable@substruct |
{ macro make@substruct substruct,parent,name,[field,type,def] |
\{ \common |
\local define |
define equ parent,name |
\forward |
\local sub |
match , field \\{ match any, type \\\{ enable@substruct |
make@substruct type,name,sub def |
purge make@substruct |
define equ define,.,sub, \\\} \\} |
match any, field \\{ define equ define,.\#field,type,<def> \\} |
\common |
match fields, define \\{ define@\#substruct fields \\} \} } |
enable@substruct |
macro define@union parent,name,[field,type,def] |
{ common |
virtual at 0 |
forward |
if ~ field eq . |
virtual at 0 |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
end virtual |
if sizeof.#parent#field > $ |
rb sizeof.#parent#field - $ |
end if |
else if sizeof.#type > $ |
rb sizeof.#type - $ |
end if |
common |
sizeof.#name = $ |
end virtual |
struc name [value] \{ \common |
label .\#name |
last@union equ |
forward |
match any, last@union \\{ virtual at .\#name |
field type def |
end virtual \\} |
match , last@union \\{ match , value \\\{ field type def \\\} |
match any, value \\\{ field type value \\\} \\} |
last@union equ field |
common rb sizeof.#name - ($ - .\#name) \} } |
macro define@substruct parent,name,[field,type,def] |
{ common |
virtual at 0 |
forward |
if ~ field eq . |
parent#field type def |
sizeof.#parent#field = $ - parent#field |
else |
rb sizeof.#type |
end if |
local value |
common |
sizeof.#name = $ |
end virtual |
struc name value \{ |
label .\#name |
forward |
match , value \\{ field type def \\} |
match any, value \\{ field type value |
if ~ field eq . |
rb sizeof.#parent#field - ($-field) |
end if \\} |
common \} } |
/programs/system/MyKey/trunk |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |
/programs/system/MyKey/. |
---|
Property changes: |
Added: tsvn:logminsize |
+5 |
\ No newline at end of property |