Pages: 1
  Print  
Author Topic: Ini Plugin Upgrade  (Read 1420 times)
Offline (Unknown gender) sorlok_reaves
Posted on: August 10, 2014, 09:28:13 PM
Contributor
Joined: Dec 2013
Posts: 261

View Profile
Hello all,

A while back I started working on some fixes to the ini plugin (which affects OSX and Linux users --Windows has its own approach). I had 3 goals:
  1) Provide basically the same behavior as GM:S (excluding obvious flaws). So, all the ini_* functions (including ini_write_*).
  2) Extend that to support saving and loading comments verbatim --now you can comment your ini files without ENIGMA eating the comments.
  3) Replacing that horribly ugly ini Extension icon.

I originally lost interest, but at Robert's request, I have polished up my branch and stabilized it. You can try it out here:
https://github.com/sorlok/enigma-dev/compare/sorlok:robust_inis

A sample ini file that the plugin can load and save (mostly) verbatim:
Code: [Select]
; Comments can appear above sections.
[somesection]
test = hi ;..also after vars
test2 = " hi "

;Var quote
test3 = " hi " ;quotes are used to preserve spaces in values.
test4 = hi ;test
test5 = hi
test6 = hi ;tset
test7 = "hi;" ;...quotes also help if the comment character is inside your value
test8 = "newvar;"

;A comment at the end of the file

Please let me know your thoughts on this. I'm still debugging weird edge cases, but once it's stable I'll prepare a pull request.
Logged
Offline (Male) Goombert
Reply #1 Posted on: August 10, 2014, 11:53:19 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Yes I hate to pressure you into this sorlok, but what you have is clearly better than what is currently in the repository, eg. better than nothing. And this has also been a highly requested feature for *nix as well. I am also astonished with your progress and commits as well, you're a very good contributor and I and the project are eternally grateful.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Unknown gender) sorlok_reaves
Reply #2 Posted on: August 11, 2014, 07:49:15 PM
Contributor
Joined: Dec 2013
Posts: 261

View Profile
I'm happy to help; I was actually going to add this eventually for another project anyway.

There is one issue that needs to be addressed; currently in ENIGMA, we have:
Code: [Select]
int ini_read_real(std::string section, std::string key, int defaultValue);
void ini_write_real(std::string section, std::string key, int value);

In reality, GM:S typically reads and writes floats (or maybe doubles), not ints. Hence the name, ini_read/write_real. These are globally defined in PFini.h.

If I change these to return floats, will that mess up anything in the Windows ini bindings?
Logged
Offline (Male) Goombert
Reply #3 Posted on: August 11, 2014, 11:27:58 PM

Developer
Location: Cappuccino, CA
Joined: Jan 2013
Posts: 3110

View Profile
Actually, they should maybe probably be var, does that seem more sensible? I am not sure, would be nice if Josh could weigh in.
Logged
I think it was Leonardo da Vinci who once said something along the lines of "If you build the robots, they will make games." or something to that effect.

Offline (Male) Josh @ Dreamland
Reply #4 Posted on: August 15, 2014, 06:45:38 PM

Prince of all Goldfish
Developer
Location: Pittsburgh, PA, USA
Joined: Feb 2008
Posts: 2958

View Profile Email
Exciting; I like the new feature set. Though it could make the functions less efficient, so I'd be careful. Probably not an issue; INI just isn't a great format to begin with.

Anyway, no, if you know that the type is real, then using var is pointless. I don't care if you overload it for integer types and float types. I'm inclined to agree that real implies float/double. A solution that can't *break* Windows is to overload both. However, if you do have multiple overloads, you'll have to overload for const var/variant&, otherwise the call will be ambiguous.
Logged
"That is the single most cryptic piece of code I have ever seen." -Master PobbleWobble
"I disapprove of what you say, but I will defend to the death your right to say it." -Evelyn Beatrice Hall, Friends of Voltaire
Pages: 1
  Print