www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - [RFC] Ini parser

reply "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
Just a quick follow up on:

https://github.com/D-Programming-Language/phobos/pull/449

I wasn't aware that .ini was deprecated by Microsoft. What's their
touted replacement for it?

Also, I know that there are applications out there that use the .ini
format, even though they aren't specific to Windows. To choose a random
example, the Opera web browser (I use the Linux version, and its config
file is in .ini format).

Another example is git.

So I think this might be something useful to have in Phobos. Just my
$0.02.


T

-- 
Spaghetti code may be tangly, but lasagna code is just cheesy.
Feb 26 2012
next sibling parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
On 26/02/2012 15:58, H. S. Teoh wrote:
 Just a quick follow up on:

 https://github.com/D-Programming-Language/phobos/pull/449

 I wasn't aware that .ini was deprecated by Microsoft. What's their
 touted replacement for it?
The registry. Besides, the code you've linked to seems to me to be an implementation not of M$'s .ini format, but of something more general.
 Also, I know that there are applications out there that use the .ini
 format, even though they aren't specific to Windows. To choose a random
 example, the Opera web browser (I use the Linux version, and its config
 file is in .ini format).
Yes, I think you'll find many cross-platform apps that store configuration in files rather than in the registry. In some of these cases, the developers chose the Windows .ini format or something based on it. FTR: While I was doing my PhD I created a configuration file format, which I called Configur8. It is similar to .ini, but with a different notation for section headings and with one or two extra features such as importing another Configur8 file and overriding some of the settings in it. I implemented it in C++ and Fortrash 90. I haven't got round to porting it to D, partly as I haven't had use for it in my personal projects, but it would be straightforward once I've managed to dig it up.
 Another example is git.

 So I think this might be something useful to have in Phobos. Just my
 $0.02.
Is there an open-standard format that we can follow, other than one that already has a different name (such as YAML or XML)? IMM it makes little sense to have an implementation of a proprietary or ad-hoc data format in Phobos (except possibly as part of a common API supporting a variety of open and proprietary formats). Stewart.
Feb 27 2012
parent reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le lundi 27 f=C3=A9vrier 2012 =C3=A0 13:44 +0000, Stewart Gordon a =C3=A9cr=
it :
 On 26/02/2012 15:58, H. S. Teoh wrote:
 Just a quick follow up on:

 https://github.com/D-Programming-Language/phobos/pull/449

 I wasn't aware that .ini was deprecated by Microsoft. What's their
 touted replacement for it?
=20 The registry. =20 Besides, the code you've linked to seems to me to be an implementation no=
t of M$'s .ini=20
 format, but of something more general.
=20
 Also, I know that there are applications out there that use the .ini
 format, even though they aren't specific to Windows. To choose a random
 example, the Opera web browser (I use the Linux version, and its config
 file is in .ini format).
=20 Yes, I think you'll find many cross-platform apps that store configuratio=
n in files rather=20
 than in the registry.  In some of these cases, the developers chose the W=
indows .ini=20
 format or something based on it.
=20
 FTR: While I was doing my PhD I created a configuration file format, whic=
h I called=20
 Configur8.  It is similar to .ini, but with a different notation for sect=
ion headings and=20
 with one or two extra features such as importing another Configur8 file a=
nd overriding=20
 some of the settings in it.
=20
 I implemented it in C++ and Fortrash 90.  I haven't got round to porting =
it to D, partly=20
 as I haven't had use for it in my personal projects, but it would be stra=
ightforward once=20
 I've managed to dig it up.
=20
 Another example is git.

 So I think this might be something useful to have in Phobos. Just my
 $0.02.
=20 Is there an open-standard format that we can follow, other than one that =
already has a=20
 different name (such as YAML or XML)?  IMM it makes little sense to have =
an implementation=20
 of a proprietary or ad-hoc data format in Phobos (except possibly as part=
of a common API=20
 supporting a variety of open and proprietary formats).
=20
 Stewart.
the code support default .ini spec and in more allow to have subsection
Feb 27 2012
parent reply Stewart Gordon <smjg_1998 yahoo.com> writes:
On 27/02/2012 14:20, bioinfornatics wrote:
<snip excessive quote>
 the code support default .ini spec and in more allow to have subsection
Where is this format called "default .ini" defined exactly? And where is the superset of "default .ini" that has subsections defined exactly? Stewart.
Feb 28 2012
parent reply bioinfornatics <bioinfornatics fedoraproject.org> writes:
Le mardi 28 f=C3=A9vrier 2012 =C3=A0 23:45 +0000, Stewart Gordon a =C3=A9cr=
it :
 On 27/02/2012 14:20, bioinfornatics wrote:
 <snip excessive quote>
 the code support default .ini spec and in more allow to have subsection
=20 Where is this format called "default .ini" defined exactly? =20 And where is the superset of "default .ini" that has subsections defined =
exactly?
=20
 Stewart.
They are all you want here: http://sourceforge.net/apps/trac/chaoslizard/wiki/Docs/Ni/FileFormat
Feb 29 2012
parent Stewart Gordon <smjg_1998 yahoo.com> writes:
On 29/02/2012 12:24, bioinfornatics wrote:
<snip>
 They are all you want here:
 http://sourceforge.net/apps/trac/chaoslizard/wiki/Docs/Ni/FileFormat
So it's somewhat more complex than the Windows .ini format. What's more, it isn't compatible with the Windows .ini format, under which backslashes (e.g. in pathnames) are interpreted just as they are, not as escapes. Configur8, and I guess the Windows .ini format as well, takes the view that you won't need to include reserved characters in section or key names, and apps that need to include them in values would define their own means of encoding them, thereby keeping the format simple. I'm still not convinced that this Nickel .ini format is anything more than a format created for one library and that is likely to be used only by people who use that library. This brings us back to the points I've already raised about implementing a standardised format if any. Stewart.
Feb 29 2012
prev sibling parent "Jesse Phillips" <jessekphillips+D gmail.com> writes:
On Sunday, 26 February 2012 at 15:56:50 UTC, H. S. Teoh wrote:
 Just a quick follow up on:

 https://github.com/D-Programming-Language/phobos/pull/449

 I wasn't aware that .ini was deprecated by Microsoft. What's 
 their
 touted replacement for it?
XML
 Also, I know that there are applications out there that use the 
 .ini
 format, even though they aren't specific to Windows. To choose 
 a random
 example, the Opera web browser (I use the Linux version, and 
 its config
 file is in .ini format).
Yep, I can not say it is Windows specific either. It may not be a format recommended, but nor is csv. ini files allow for nice key value pairs, like many conf files in linux.
 Another example is git.

 So I think this might be something useful to have in Phobos. 
 Just my
 $0.02.
Agreed.
Feb 29 2012