parse_fn.inc use mikedld librares (shuld be in %sys%/lib)

http://mikedld.com/f/libs-dev-3.7z

at sys.conf added network konfiguration

git-svn-id: svn://kolibrios.org@512 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
SPraid (simba) 2007-05-20 09:04:59 +00:00
parent d018bf5849
commit 0b7151a256
5 changed files with 212 additions and 65 deletions

View File

@ -8,16 +8,10 @@
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
conf_file_loaded: db 0 ; ä« £ § £à㧪¨ ª®­ä¨£  conf_file_loaded: db 0 ; ä« £ § £à㧪¨ ª®­ä¨£ 
conf_path_sect: db 'path',0
conf_fname db '%sys%/sys.conf',0
; § £à㧪  ¨­¨ ä ©«  ¢ ¡¨¡«¨®â¥ªã
proc load_conf_file
pushad
invoke ini.load,.fname
mov [conf_file_loaded],byte 1
popad
ret
.fname db '%sys%/sys.conf',0
endp
proc set_kernel_conf proc set_kernel_conf
@ -27,10 +21,9 @@ endl
pushad pushad
;[gui] ;[gui]
;mouse_speed ;mouse_speed
mov eax,ebp lea eax,[par]
add eax,par-ebp
push eax push eax
invoke ini.get_str, ugui, ugui_mouse_speed, eax, ugui_mouse_speed_def invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
push eax push eax
@ -41,10 +34,9 @@ endl
ret ret
;mouse_delay ;mouse_delay
mov eax,ebp lea eax,[par]
add eax,par-ebp
push eax push eax
invoke ini.get_str, ugui, ugui_mouse_delay, eax, ugui_mouse_delay_def invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
push eax push eax
@ -53,10 +45,9 @@ endl
;[dev] ;[dev]
;sb16 ;sb16
mov eax,ebp lea eax,[par]
add eax,par-ebp
push eax push eax
invoke ini.get_str, udev, udev_sb16, eax, udev_sb16_def invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
push eax push eax
@ -64,10 +55,9 @@ endl
call _sb16 call _sb16
;sound_dma ;sound_dma
mov eax,ebp lea eax,[par]
add eax,par-ebp
push eax push eax
invoke ini.get_str, udev, udev_sound_dma, eax, udev_sound_dma_def invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
push eax push eax
@ -76,16 +66,16 @@ endl
;midibase ;midibase
mov eax,ebp lea eax,[par]
add eax,par-ebp
push eax push eax
invoke ini.get_str, udev, udev_midibase, eax, udev_midibase_def invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
push eax push eax
pop ecx pop ecx
call _midibase call _midibase
popad popad
ret ret
endp endp
@ -104,6 +94,63 @@ udev_sound_dma_def db '1',0
udev_midibase db 'midibase',0 udev_midibase db 'midibase',0
udev_midibase_def db '0x320',0 udev_midibase_def db '0x320',0
proc set_network_conf
locals
par db 30 dup(?)
endl
pushad
;[net]
;active
lea eax,[par]
invoke ini.get_int,conf_fname, unet, unet_active, 0
or eax,eax
jz .do_not_set_net
call _net_up
;addr
lea eax,[par]
push eax
invoke ini.get_str,conf_fname, unet, unet_addr, eax,30, unet_def
pop eax
stdcall do_inet_adr,eax
push eax
pop ecx
call _net_addr
;mask
lea eax,[par]
push eax
invoke ini.get_str,conf_fname, unet, unet_mask, eax,30, unet_def
pop eax
stdcall do_inet_adr,eax
push eax
pop ecx
call _net_mask
;gate
lea eax,[par]
push eax
invoke ini.get_str,conf_fname, unet, unet_gate, eax,30, unet_def
pop eax
stdcall do_inet_adr,eax
push eax
pop ecx
call _net_gate
.do_not_set_net:
popad
ret
endp
unet db 'net',0
unet_active db 'active',0
unet_addr db 'addr',0
unet_mask db 'mask',0
unet_gate db 'gate',0
unet_def db 0
; ª®­¢¥à祭¨¥ áâப¨ ¢ DWord ¢ eax (¯® ¢â®à®¬ã ᨬ¢®«ã ®¯à¥¤¥«ï¥â á¨á⥬ã áç¨á«¥­¨ï) ; ª®­¢¥à祭¨¥ áâப¨ ¢ DWord ¢ eax (¯® ¢â®à®¬ã ᨬ¢®«ã ®¯à¥¤¥«ï¥â á¨á⥬ã áç¨á«¥­¨ï)
proc strtoint stdcall,strs proc strtoint stdcall,strs
@ -238,6 +285,39 @@ proc strtoint_hex stdcall,strs
endp endp
; ¯à¥®¡à §®¢ âì  ¤à¥á ¢ â® çâ® ­ ¤ , ¥á«¨ ¯ãáâ® â® ¢¥à­ãâì 0
proc do_inet_adr stdcall,strs
pushad
mov esi,[strs]
mov ebx,0
.next:
push esi
@@:
lodsb
or al,al
jz @f
cmp al,'.'
jz @f
jmp @b
@@:
mov cl, al
mov [esi-1],byte 0
;pop eax
call strtoint_dec
rol eax,24
ror ebx,8
add ebx,eax
or cl,cl
jz @f
jmp .next
@@:
mov [esp+28],ebx
popad
ret
endp
; ãáâ ­®¢ª¨ ¨§ setup ; ãáâ ­®¢ª¨ ¨§ setup
_mouse_speed: _mouse_speed:
@ -272,3 +352,34 @@ _midibase:
mov ebx,1 mov ebx,1
int 0x40 int 0x40
ret ret
_net_addr:
mov eax,52
mov ebx,3
int 0x40
ret
_net_mask:
mov eax,52
mov ebx,12
int 0x40
ret
_net_gate:
mov eax,52
mov ebx,11
int 0x40
ret
_net_up:
mov eax,52
mov ebx,0
int 0x40
and eax,0xFFFFFF80
add eax,3
mov ecx,eax
mov eax,52
mov ebx,2
int 0x40
ret

View File

@ -7,19 +7,15 @@
; ;
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
full_file_name_table dd 0 ; 㪠§ â¥«ì ­  ¯ ¬ïâì ¤«ï â ¡«¨æë ¯ã⥩ 4Š § ¯¨áì 64 (32 - áâப  è ¡«®­ ¤«ï ¯®¨áª , 32 - áâப  è ¡«®­ ¤«ï § ¬¥­ë)
; ¯¥à¥¡¨à ¥â ¯® ä ©«ã ¢ à¨ ­âë § ¬¥­ ; ¯¥à¥¡¨à ¥â ¯® ä ©«ã ¢ à¨ ­âë § ¬¥­
proc full_file_name stdcall,sourc,dest proc full_file_name stdcall,sourc,dest
locals locals
param rb 60
val rb 60
tmpsrc rb 60 ; ¢à¥¬¥­­®¥ åà ­¥­¨¥ ¯à¥®¡à §®¢ ­¨ï tmpsrc rb 60 ; ¢à¥¬¥­­®¥ åà ­¥­¨¥ ¯à¥®¡à §®¢ ­¨ï
endl endl
pushad pushad
mov esi,[sourc] mov esi,[sourc]
; mov edi,ebp
; add edi,tmpsrc-ebp
lea edi, [tmpsrc] lea edi, [tmpsrc]
@@: @@:
@ -41,34 +37,22 @@ endl
xor eax,eax xor eax,eax
.loop: .loop:
push eax push eax
; mov ebx,ebp
; add ebx,param-ebp
; mov ecx,ebp
; add ecx,val-ebp
lea ebx, [param]
lea ecx, [val]
invoke ini.get_par,sect, ebx, ecx, eax
mov bl,[param] imul eax,eax,64
or bl,bl add eax,[full_file_name_table]
mov ebx,eax
add eax,32
mov cl,[ebx]
or cl,cl
jz .done jz .done
; mov eax,ebp lea ecx, [tmpsrc]
; add eax,tmpsrc-ebp
; mov ebx,ebp
; add ebx,param-ebp
; mov ecx,ebp
; add ecx,val-ebp
lea eax, [tmpsrc]
lea ebx, [param]
lea ecx, [val]
mov edx,[dest] mov edx,[dest]
stdcall full_file_name_parse, eax,edx,ebx,ecx stdcall full_file_name_parse, ecx,edx,ebx,eax
mov esi,[dest] mov esi,[dest]
; mov edi,ebp
; add edi,tmpsrc-ebp
lea edi, [tmpsrc] lea edi, [tmpsrc]
@@: @@:
lodsb lodsb
@ -84,16 +68,12 @@ endl
pop eax pop eax
full_file_name_exit: full_file_name_exit:
; mov eax,ebp
; add eax,tmpsrc-ebp
lea eax, [tmpsrc] lea eax, [tmpsrc]
stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path stdcall full_file_name_parse , eax , [dest], sysdir_ , sys_path
popad popad
ret ret
endp endp
sect: db 'path',0
; ;
; <EFBFBD>८¡à §®¢ âì ¨¬ï ¢ ¯®«­®¥. …᫨ ¢ ­ ç «¥ á⮨â ; <EFBFBD>८¡à §®¢ âì ¨¬ï ¢ ¯®«­®¥. …᫨ ¢ ­ ç «¥ á⮨â
; sourc - áá뫪  ­  áâபã... ; sourc - áá뫪  ­  áâபã...
@ -190,3 +170,47 @@ Parser_params:
popad popad
ret ret
proc load_file_parse_table
pushad
stdcall kernel_alloc,0x1000
mov [full_file_name_table],eax
invoke ini.enum_keys,conf_fname,conf_path_sect,get_every_key
mov eax,[loading_counter]
imul eax,eax,64
add eax,[full_file_name_table]
mov [eax],byte 0
popad
ret
endp
loading_counter dd 0
def_val_1 db 0
proc get_every_key stdcall,f_name, sec_name, key_name
pushad
mov esi,[key_name]
mov edi,[loading_counter]
imul edi,edi,64
add edi,[full_file_name_table]
@@:
lodsb
stosb
or al,al
jnz @b
mov eax,[loading_counter]
imul eax,eax,64
add eax,[full_file_name_table]
add eax,32
mov ebx,[key_name]
invoke ini.get_str,conf_fname,conf_path_sect,ebx,eax,32,def_val_1
inc dword [loading_counter]
popad
mov eax,1
ret
endp

View File

@ -546,8 +546,9 @@ include 'vmodeld.inc'
je no_lib_load je no_lib_load
; LOADING LIBRARES ; LOADING LIBRARES
stdcall dll.Load,@IMPORT ; SPraid - çàãðóçêà ôóíêöèîíàëà (ïîêà ÷òî èíè ôàéë) stdcall dll.Load,@IMPORT ; SPraid - çàãðóçêà ôóíêöèîíàëà (ïîêà ÷òî èíè ôàéë)
call load_conf_file ; prepare configuration file call load_file_parse_table ; prepare file parse table
call set_kernel_conf ; configure devices and gui call set_kernel_conf ; configure devices and gui
mov byte [conf_file_loaded],1
no_lib_load: no_lib_load:
; LOAD FONTS I and II ; LOAD FONTS I and II
@ -754,6 +755,12 @@ no_lib_load:
stdcall map_page,tss._io_map_1,\ stdcall map_page,tss._io_map_1,\
(tss._io_map_1-OS_BASE), PG_MAP (tss._io_map_1-OS_BASE), PG_MAP
mov ax,[OS_BASE+0x10000+bx_from_load]
cmp ax,'r1' ; åñëè ñðàì äèñê - òî íå ãðóçèòü áèáëèîòåêè
je no_st_network
call set_network_conf
no_st_network:
; LOAD FIRST APPLICATION ; LOAD FIRST APPLICATION
cli cli

View File

@ -13,9 +13,10 @@
@IMPORT: @IMPORT:
library \ library \
libini,'inifiles.obj' libini,'libini.obj'
import libini, \ import libini, \
ini.load,'ini.load',\ lib_init,'lib_init',\
ini.get_str,'ini.get_str',\ ini.get_str,'ini.get_str',\
ini.get_par,'ini.get_par' ini.enum_keys,'ini.enum_keys',\
ini.get_int,'ini.get_int'

View File

@ -2,13 +2,17 @@
/rd/1=%sys% /rd/1=%sys%
%sys%/dll=%sys%/lib %sys%/dll=%sys%/lib
[net]
active=1
addr=192.168.1.2
mask=255.255.255.0
gate=192.168.1.1
[gui] [gui]
mouse_speed=2 mouse_speed=1
mouse_delay=0x00A mouse_delay=0x00A
[dev] [dev]
sb16=0x220 sb16=0x220
sound_dma=1 sound_dma=1
midibase=0x320 midibase=0x320
[end]