Page 1 of 1

Common libraries collection 5

Posted: Wed Sep 26, 2007 12:36 pm
by mike.dld
Version 5 is available,
libini changelog wrote:; 2007-09-26 (mike.dld)
; bug-fixes:
; - value was not correctly trimmed (reported by diamond)
libio changelog wrote:; 2007-09-26 (mike.dld)
; changes:
; - modified file.size a bit (according to changes in FileInfo struct)
; - added file.find_first, file.find_next, file.find_close
; notes:
; - file.aux.match_wildcard is exported only for testing purposes, don't use it since it may be removed or renamed in next versions

Re: Common libraries collection 5

Posted: Thu Sep 27, 2007 2:38 pm
by mike.dld
I'll upload all the source code to SVN someday in near future, so if anyone has an ability to provide bindings for libraries to be used in other languages than assembler - you're welcome.

Appropriate bindings for some languages to use libini may look like (without additional specifiers):

C:

Code: Select all

typedef BOOL (*ini_section_callback_t)(char *filename, char *section_name);
typedef BOOL (*ini_key_callback_t)(char *filename, char *section_name, char *key_name, char *key_value);

int ini_enum_sections(char *filename, ini_section_callback_t callback);
int ini_enum_keys(char *filename, char *section_name, ini_key_callback_t callback);
int ini_get_str(char *filename, char *section_name, char *key_name, char *buffer, int buffer_size, char *default_value);
int ini_set_str(char *filename, char *section_name, char *key_name, char *value, int value_size);
int ini_get_int(char *filename, char *section_name, char *key_name, int default_value);
int ini_set_int(char *filename, char *section_name, char *key_name, int value);
Pascal:

Code: Select all

type
  PIniSectionCallback = ^TIniSectionCallback;
  TIniSectionCallback = function(FileName, SectionName: PChar): LongBool;
  PIniKeyCallback = ^TIniKeyCallback;
  TIniKeyCallback = function(FileName, SectionName, KeyName, KeyValue: PChar): LongBool;

function IniEnumSections(FileName: PChar; Callback: PIniSectionCallback): Integer;
function IniEnumKeys(FileName, SectionName: PChar; Callback: PIniKeyCallback): Integer;
function IniGetStr(FileName, SectionName, KeyName: PChar; Buffer: PChar; BufferSize: Integer; DefaultValue: PChar): Integer;
function IniSetStr(FileName, SectionName, KeyName: PChar; Value: PChar; ValueSize: Integer): Integer;
function IniGetInt(FileName, SectionName, KeyName: PChar; DefaultValue: Integer): Integer;
function IniSetInt(FileName, SectionName, KeyName: PChar; Value: Integer): Integer;