This is a library for a new configuration file type.
// name | value
name: String = "CapySettings"
smart: Boolean = true
usefulness: Integer = 10 // out of 10
version: Float = 1.0
Why make another configuration/markdown file again. Simply, USABILITY. I have had the issue of having data from these config/markdown files be provided in string format. This is an issue as if you forget to cast the result, your program will crash or simply execute undefined behavior and thats never good. So I created a statically typed configuration/markdown file type. I also wanted comments to better explain certain values. And making a statically typed configuration file, also provides the editor of such a file, better understanding of what value is expected.
So I predominantly work on a barebones Windows/MinGW build, so my ways maybe archaic, but they work for me. You may also try the build.py, but I made it for my systems so it might not work.
gcc -c lib-src/CapySettings.c -o c-lib/static-lib/CapySettings.o
You may modify the output file, just be aware the other commands use this Repo as a structure
ar rcs c-lib/static-lib/libCapySettings.a c-lib/static-lib/CapySettings.o
Then when building your code with gcc dont forget to use:
-Lc-lib/static-lib -lCapySettings
Again if you modified the output please change the flags respective of your change.
--- Version 1 ---
-
Fix CapySettings_AddSetting to not add multiple settings of the same name.
-
Fix library for linux. Skeeto reported bug, I got the same results.
- Change reading to be buffer based
- New function CapySettings_LoadFromFile(FILE* pFile, bool debug); Purpose is to leave opening to developer, and simply create the proper structs
-
Implement Ada notation
// For example: Variable1, Variable2, Variable3: Integer = 1, 2, 3
--- Version 2 ---
- Float conversion is iffy, and not precise
//For example: calculatedBenefits: Float = 1896.87 // Returns: // "calculatedBenefits": 1896.869995 // Should return: // "calculatedBenefits": 1896.87
- Implement arrays
- Make a CapySettings_EditSetting function to edit values in the CapySettings
- Inplace Literals
// For example: song: String = "Adieu" name: String = name // "Adieu"
- New datatypes for different size
// For example: Int64 // (default, Integer|Int) Int32 Int16 Int8 String64 // (default, String) String32 ...
- Python implementation