1) LibIni downgraded to revision 1233 due to license problems
2) Created GPL 3+ fork of it (libconfig) with all functions from last libini revision git-svn-id: svn://kolibrios.org@1291 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -1,49 +0,0 @@
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Copyright (C) Vasiliy Kosenko (vkos), 2009 ;;
|
||||
;; This program is free software: you can redistribute it and/or modify it under the terms of ;;
|
||||
;; the GNU General Public License as published by the Free Software Foundation, either version 3 ;;
|
||||
;; of the License, or (at your option) any later version. ;;
|
||||
;; ;;
|
||||
;; This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; ;;
|
||||
;; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ;;
|
||||
;; See the GNU General Public License for more details. ;;
|
||||
;; ;;
|
||||
;; You should have received a copy of the GNU General Public License along with this program. ;;
|
||||
;; If not, see <http://www.gnu.org/licenses/>. ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; Now there is only one function now: find string in array of strings ;;
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
;; int str_find_in_array(char **options, char *str)
|
||||
;; NOTE: options should be zero-ended array
|
||||
str_find_in_array:
|
||||
push ebx
|
||||
|
||||
mov ebx, [esp+8]
|
||||
cld
|
||||
.convert_nxt:
|
||||
add ebx, 4
|
||||
mov esi, dword [ebx-4]
|
||||
test esi, esi
|
||||
je .set_default ;; String is incorrect, so set default
|
||||
mov edi, [esp+0xc]
|
||||
.conv_loop:
|
||||
cmpsb
|
||||
jne .convert_nxt ;; Not equal, so try next
|
||||
dec esi
|
||||
lodsb
|
||||
test al, al
|
||||
jne .conv_loop
|
||||
.found:
|
||||
sub ebx, [esp+8]
|
||||
shr ebx, 2
|
||||
mov eax, ebx
|
||||
.exit:
|
||||
dec eax
|
||||
pop ebx
|
||||
ret
|
||||
.set_default:
|
||||
xor eax, eax
|
||||
jmp .exit
|
@@ -1,7 +1,5 @@
|
||||
;;================================================================================================;;
|
||||
;;//// libini.asm ////////////////////////////////////////////////////////////////////////////////;;
|
||||
;;//// (c) mike.dld, 2006-2008 ///////////////////////////////////////////////////////////////;;
|
||||
;;//// (c) Vasiliy Kosenko, 2009 ///////////////////////////////////////////////////////////////;;
|
||||
;;//// libini.asm //// (c) mike.dld, 2006-2008 ///////////////////////////////////////////////////;;
|
||||
;;================================================================================================;;
|
||||
;; ;;
|
||||
;; This file is part of Common development libraries (Libs-Dev). ;;
|
||||
@@ -19,12 +17,6 @@
|
||||
;; ;;
|
||||
;;================================================================================================;;
|
||||
;; ;;
|
||||
;; 2009-10-27 (vkos) ;;
|
||||
;; new features: ;;
|
||||
;; - new function: ini.get_bool ;;
|
||||
;; 2009-10-25 (vkos) ;;
|
||||
;; new features: ;;
|
||||
;; - new function: ini.get_option_str ;;
|
||||
;; 2009-03-08 (mike.dld) ;;
|
||||
;; bug-fixes: ;;
|
||||
;; - moved buffer bound check in libini._.low.read_value up (reported by Insolor) ;;
|
||||
@@ -80,10 +72,6 @@ section '.flat' code readable align 16
|
||||
|
||||
include 'libini_p.asm'
|
||||
|
||||
;; For ini.get_option_str
|
||||
str_find_in_array fix libini._.find_string
|
||||
include 'find_str.asm'
|
||||
|
||||
;;================================================================================================;;
|
||||
proc ini.enum_sections _f_name, _callback ;///////////////////////////////////////////////////////;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
@@ -669,83 +657,6 @@ endl
|
||||
ret
|
||||
endp
|
||||
|
||||
;;================================================================================================;;
|
||||
proc ini.get_option_str _f_name, _sec_name, _key_name, _option_list, _length, _def_val ;//////////;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;? Read string, compare with list of possible & return its' number ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;> _f_name = ini filename <asciiz> ;;
|
||||
;> _sec_name = section name <asciiz> ;;
|
||||
;> _key_name = key name <asciiz> ;;
|
||||
;> _option_list = list of options <pointer to zero-ended archive of asciiz-pointers> ;;
|
||||
;> _length = maximum length of string ;;
|
||||
;> _def_val = default value to return if no key, section, file found or incorrect string <dword> ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;< eax = [_def_val] (error) / number of option string in _option_list <dword> ;;
|
||||
;;================================================================================================;;
|
||||
locals
|
||||
buff rb ini.MAX_VALUE_LEN
|
||||
endl
|
||||
|
||||
lea eax, [buff]
|
||||
stdcall ini.get_str, [_f_name], [_sec_name], [_key_name], eax, ini.MAX_VALUE_LEN
|
||||
|
||||
inc eax
|
||||
test eax, eax
|
||||
je .default
|
||||
|
||||
;; Now convert option from string to number
|
||||
lea eax, [buff]
|
||||
sub esp, 4
|
||||
stdcall libini._.find_string, [_option_list], eax
|
||||
add esp, 4
|
||||
|
||||
inc eax
|
||||
test eax, eax
|
||||
je .default
|
||||
dec eax
|
||||
jmp .exit
|
||||
|
||||
.default:
|
||||
mov eax, dword [_def_val]
|
||||
|
||||
.exit:
|
||||
ret
|
||||
endp
|
||||
|
||||
;; Note that order of following array should be: false-true-false-true-...-0
|
||||
_bool_strings_list:
|
||||
dd _bool_no
|
||||
dd _bool_yes
|
||||
dd _bool_disabled
|
||||
dd _bool_enabled
|
||||
dd _bool_false
|
||||
dd _bool_true
|
||||
dd 0
|
||||
|
||||
_bool_no: db "no", 0
|
||||
_bool_false: db "false", 0
|
||||
_bool_disabled: db "disabled", 0
|
||||
_bool_yes: db "yes", 0
|
||||
_bool_true: db "true", 0
|
||||
_bool_enabled: db "enabled", 0
|
||||
|
||||
;;================================================================================================;;
|
||||
proc ini.get_bool _f_name, _sec_name, _key_name, _def_val ;///////////////////////////////////////;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;? Read boolean value ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;> _f_name = ini filename <asciiz> ;;
|
||||
;> _sec_name = section name <asciiz> ;;
|
||||
;> _key_name = key name <asciiz> ;;
|
||||
;> _def_val = default value to return if no key, section, file found or incorrect string <dword> ;;
|
||||
;;------------------------------------------------------------------------------------------------;;
|
||||
;< eax = [_def_val] (error) / number of option string in _option_list <dword> ;;
|
||||
;;================================================================================================;;
|
||||
stdcall ini.get_option_str, [_f_name], [_sec_name], [_key_name], _bool_strings_list, ini.MAX_BOOL_LEN, [_def_val]
|
||||
and eax, 0x1
|
||||
ret
|
||||
endp
|
||||
|
||||
;;================================================================================================;;
|
||||
;;////////////////////////////////////////////////////////////////////////////////////////////////;;
|
||||
@@ -786,15 +697,14 @@ import libio , \
|
||||
align 16
|
||||
@EXPORT:
|
||||
|
||||
export libini._.init , 'lib_init' , \
|
||||
export \
|
||||
libini._.init , 'lib_init' , \
|
||||
0x00080008 , 'version' , \
|
||||
ini.enum_sections , 'ini_enum_sections' , \
|
||||
ini.enum_keys , 'ini_enum_keys' , \
|
||||
ini.get_str , 'ini_get_str' , \
|
||||
ini.get_int , 'ini_get_int' , \
|
||||
ini.get_color , 'ini_get_color' , \
|
||||
ini.get_option_str, 'ini_get_option_str', \
|
||||
ini.get_bool , 'ini_get_bool' , \
|
||||
ini.set_str , 'ini_set_str' , \
|
||||
ini.set_int , 'ini_set_int' , \
|
||||
ini.set_color , 'ini_set_color' ;, \
|
||||
ini.set_color , 'ini_set_color'
|
||||
|
@@ -20,7 +20,6 @@
|
||||
|
||||
ini.MAX_NAME_LEN = 1024
|
||||
ini.MAX_VALUE_LEN = 4096
|
||||
ini.MAX_BOOL_LEN = 9
|
||||
ini.MEM_SIZE = 4096
|
||||
ini.BLOCK_SIZE = ini.MEM_SIZE / 2
|
||||
|
||||
|
Reference in New Issue
Block a user