UTF-8 file path input, unicode names for apps and libs

git-svn-id: svn://kolibrios.org@6502 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pathoswithin
2016-08-25 19:30:08 +00:00
parent 5f44c836b1
commit 31fad3ee4a
9 changed files with 331 additions and 390 deletions

View File

@@ -5,17 +5,22 @@
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;============================================================================
;
; External kernel dependencies (libraries) loading
;
;============================================================================
; External kernel dependencies (libraries) loading.
; The code currently does not work, requires correcting dll.inc.
$Revision$
if 0
; The code currently does not work. Kill "if 0/end if" only after correcting
; to current kernel (dll.inc).
iglobal
tmp_file_name_size dd 1
endg
uglobal
tmp_file_name_table dd ?
s_libname rb 64
def_val_1 db ?
endg
macro library [name,fname]
{
forward
@@ -327,7 +332,145 @@ proc mem.Free mptr ;//////////////////////////////////////////////////////////
ret
endp
uglobal
s_libname db 64 dup (0)
endg
proc load_file_parse_table
stdcall kernel_alloc, 0x1000
mov [tmp_file_name_table], eax
mov edi, eax
mov esi, sysdir_name
mov ecx, 128/4
rep movsd
invoke ini.enum_keys, conf_fname, conf_path_sect, get_every_key
mov eax, [tmp_file_name_table]
mov [full_file_name_table], eax
mov eax, [tmp_file_name_size]
mov [full_file_name_table.size], eax
ret
endp
proc get_every_key stdcall, f_name, sec_name, key_name
mov esi, [key_name]
mov ecx, esi
cmp byte [esi], '/'
jnz @f
inc esi
@@:
mov edi, [tmp_file_name_size]
shl edi, 7
cmp edi, 0x1000
jae .stop_parse
add edi, [tmp_file_name_table]
lea ebx, [edi+64]
@@:
cmp edi, ebx
jae .skip_this_key
lodsb
test al, al
jz @f
or al, 20h
stosb
jmp @b
.stop_parse:
xor eax, eax
ret
@@:
stosb
invoke ini.get_str, [f_name], [sec_name], ecx, ebx, 64, def_val_1
cmp byte [ebx], '/'
jnz @f
lea esi, [ebx+1]
mov edi, ebx
mov ecx, 63
rep movsb
@@:
push ebp
mov ebp, [tmp_file_name_table]
mov ecx, [tmp_file_name_size]
jecxz .noreplace
mov eax, ecx
dec eax
shl eax, 7
add ebp, eax
.replace_loop:
mov edi, ebx
mov esi, ebp
@@:
lodsb
test al, al
jz .doreplace
mov dl, [edi]
inc edi
test dl, dl
jz .replace_loop_cont
or dl, 20h
cmp al, dl
jz @b
jmp .replace_loop_cont
.doreplace:
cmp byte [edi], 0
jz @f
cmp byte [edi], '/'
jnz .replace_loop_cont
@@:
lea esi, [ebp+64]
call .replace
jc .skip_this_key2
.replace_loop_cont:
sub ebp, 128
loop .replace_loop
.noreplace:
pop ebp
inc [tmp_file_name_size]
.skip_this_key:
xor eax, eax
inc eax
ret
.skip_this_key2:
pop ebp
jmp .skip_this_key
endp
proc get_every_key.replace
; in: ebx->destination, esi->first part of name, edi->second part of name
; maximum length is 64 bytes
; out: CF=1 <=> overflow
sub esp, 64 ; allocate temporary buffer in stack
push esi
lea esi, [esp+4] ; esi->tmp buffer
xchg esi, edi ; edi->tmp buffer, esi->source
@@: ; save second part of name to temporary buffer
lodsb
stosb
test al, al
jnz @b
pop esi
mov edi, ebx
@@: ; copy first part of name to destination
lodsb
test al, al
jz @f
stosb
jmp @b
@@: ; restore second part of name from temporary buffer to destination
lea edx, [ebx+64] ; limit of destination
mov esi, esp
@@:
cmp edi, edx
jae .overflow
lodsb
stosb
test al, al
jnz @b
add esp, 64 ; CF is cleared
ret
.overflow: ; name is too long
add esp, 64
stc
ret
endp
end if