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:
vkos
2009-11-28 11:43:35 +00:00
parent b92de5cfd2
commit c81e27d3e4
6 changed files with 1462 additions and 95 deletions

View File

@@ -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'