Subversion Repositories Kolibri OS

Rev

Rev 5363 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5363 Rev 6502
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line -...
7
 
-
 
8
;============================================================================
-
 
9
;
7
 
10
;   External kernel dependencies (libraries) loading
-
 
11
;
8
; External kernel dependencies (libraries) loading.
Line 12... Line 9...
12
;============================================================================
9
; The code currently does not work, requires correcting dll.inc.
Line 13... Line 10...
13
 
10
 
-
 
11
$Revision: 6502 $
14
$Revision: 5363 $
12
 
-
 
13
if 0
-
 
14
iglobal
-
 
15
tmp_file_name_size  dd  1
15
 
16
endg
-
 
17
 
-
 
18
uglobal
-
 
19
tmp_file_name_table dd  ?
-
 
20
s_libname   rb  64
16
if 0
21
def_val_1   db  ?
17
; The code currently does not work. Kill "if 0/end if" only after correcting
22
endg
18
; to current kernel (dll.inc).
23
 
19
macro library [name,fname]
24
macro library [name,fname]
20
{
25
{
Line 325... Line 330...
325
;    @@: ret
330
;    @@: ret
326
        stdcall kernel_free, [mptr]
331
        stdcall kernel_free, [mptr]
327
        ret
332
        ret
328
endp
333
endp
Line -... Line 334...
-
 
334
 
-
 
335
proc load_file_parse_table
-
 
336
        stdcall kernel_alloc, 0x1000
-
 
337
        mov     [tmp_file_name_table], eax
-
 
338
        mov     edi, eax
-
 
339
        mov     esi, sysdir_name
-
 
340
        mov     ecx, 128/4
-
 
341
        rep movsd
-
 
342
        invoke  ini.enum_keys, conf_fname, conf_path_sect, get_every_key
-
 
343
        mov     eax, [tmp_file_name_table]
-
 
344
        mov     [full_file_name_table], eax
-
 
345
        mov     eax, [tmp_file_name_size]
-
 
346
        mov     [full_file_name_table.size], eax
-
 
347
        ret
-
 
348
endp
-
 
349
 
-
 
350
proc get_every_key stdcall, f_name, sec_name, key_name
-
 
351
        mov     esi, [key_name]
-
 
352
        mov     ecx, esi
-
 
353
        cmp     byte [esi], '/'
-
 
354
        jnz     @f
-
 
355
        inc     esi
-
 
356
@@:
-
 
357
        mov     edi, [tmp_file_name_size]
-
 
358
        shl     edi, 7
-
 
359
        cmp     edi, 0x1000
-
 
360
        jae     .stop_parse
-
 
361
        add     edi, [tmp_file_name_table]
-
 
362
        lea     ebx, [edi+64]
-
 
363
@@:
-
 
364
        cmp     edi, ebx
-
 
365
        jae     .skip_this_key
-
 
366
        lodsb
-
 
367
        test    al, al
-
 
368
        jz      @f
-
 
369
        or      al, 20h
-
 
370
        stosb
-
 
371
        jmp     @b
329
 
372
 
-
 
373
.stop_parse:
-
 
374
        xor     eax, eax
-
 
375
        ret
-
 
376
 
-
 
377
@@:
-
 
378
        stosb
-
 
379
        invoke  ini.get_str, [f_name], [sec_name], ecx, ebx, 64, def_val_1
-
 
380
        cmp     byte [ebx], '/'
-
 
381
        jnz     @f
-
 
382
        lea     esi, [ebx+1]
-
 
383
        mov     edi, ebx
-
 
384
        mov     ecx, 63
-
 
385
        rep movsb
-
 
386
@@:
-
 
387
        push    ebp
-
 
388
        mov     ebp, [tmp_file_name_table]
-
 
389
        mov     ecx, [tmp_file_name_size]
-
 
390
        jecxz   .noreplace
-
 
391
        mov     eax, ecx
-
 
392
        dec     eax
-
 
393
        shl     eax, 7
-
 
394
        add     ebp, eax
-
 
395
.replace_loop:
-
 
396
        mov     edi, ebx
-
 
397
        mov     esi, ebp
-
 
398
@@:
-
 
399
        lodsb
-
 
400
        test    al, al
-
 
401
        jz      .doreplace
-
 
402
        mov     dl, [edi]
-
 
403
        inc     edi
-
 
404
        test    dl, dl
330
uglobal
405
        jz      .replace_loop_cont
-
 
406
        or      dl, 20h
-
 
407
        cmp     al, dl
-
 
408
        jz      @b
-
 
409
        jmp     .replace_loop_cont
-
 
410
 
-
 
411
.doreplace:
-
 
412
        cmp     byte [edi], 0
-
 
413
        jz      @f
-
 
414
        cmp     byte [edi], '/'
-
 
415
        jnz     .replace_loop_cont
-
 
416
@@:
-
 
417
        lea     esi, [ebp+64]
-
 
418
        call    .replace
-
 
419
        jc      .skip_this_key2
-
 
420
.replace_loop_cont:
-
 
421
        sub     ebp, 128
-
 
422
        loop    .replace_loop
-
 
423
.noreplace:
-
 
424
        pop     ebp
-
 
425
        inc     [tmp_file_name_size]
-
 
426
.skip_this_key:
-
 
427
        xor     eax, eax
-
 
428
        inc     eax
-
 
429
        ret
-
 
430
 
-
 
431
.skip_this_key2:
-
 
432
        pop     ebp
-
 
433
        jmp     .skip_this_key
-
 
434
endp
-
 
435
 
-
 
436
proc get_every_key.replace
-
 
437
; in: ebx->destination, esi->first part of name, edi->second part of name
-
 
438
; maximum length is 64 bytes
-
 
439
; out: CF=1 <=> overflow
-
 
440
        sub     esp, 64 ; allocate temporary buffer in stack
-
 
441
        push    esi
-
 
442
        lea     esi, [esp+4]    ; esi->tmp buffer
-
 
443
        xchg    esi, edi        ; edi->tmp buffer, esi->source
-
 
444
@@: ; save second part of name to temporary buffer
-
 
445
        lodsb
-
 
446
        stosb
-
 
447
        test    al, al
-
 
448
        jnz     @b
-
 
449
        pop     esi
-
 
450
        mov     edi, ebx
-
 
451
@@: ; copy first part of name to destination
-
 
452
        lodsb
-
 
453
        test    al, al
-
 
454
        jz      @f
-
 
455
        stosb
-
 
456
        jmp     @b
-
 
457
 
-
 
458
@@: ; restore second part of name from temporary buffer to destination
-
 
459
        lea     edx, [ebx+64]   ; limit of destination
-
 
460
        mov     esi, esp
-
 
461
@@:
-
 
462
        cmp     edi, edx
-
 
463
        jae     .overflow
-
 
464
        lodsb
-
 
465
        stosb
-
 
466
        test    al, al
-
 
467
        jnz     @b
-
 
468
        add     esp, 64 ; CF is cleared
-
 
469
        ret
-
 
470
 
-
 
471
.overflow:  ; name is too long
-
 
472
        add     esp, 64
-
 
473
        stc
331
s_libname  db 64 dup (0)
474
        ret
332
endg
475
endp