toml/toml.wiki

124 lines
3.9 KiB
Plaintext
Raw Permalink Normal View History

2022-10-14 13:20:11 +00:00
[[tags: egg]]
[[toc:]]
== TOML
A Chicken wrapper for the TOML configuration language
=== Requirements
[[/eggref/5/r7rs|r7rs]]
[[/eggref/5/rfc3339|rfc3339]]
[[/eggref/5/coops|coops]]
=== Usage
<enscript language=scheme>
(import toml)
</enscript>
=== Loading TOML configuration
<syntax>(table-from-file FILENAME) --> <TomlTable></syntax>
Loads {{FILENAME}} contents as a TOML configuration.
<syntax>(table-from-string STRING) --> <TomlTable></syntax>
Loads the contents of {{STRING}} as TOML configuration.
=== Tables
<syntax>(toml-self-key TOMLTABLE) --> string</syntax>
Returns the key, if any, to which {{TOMLTABLE}} is assigned.
<syntax>(toml-key-exists? TOMLTABLE KEY) --> bool</syntax>
Checks if {{KEY}} exists in {{TOMLTABLE}}.
<syntax>(toml-count-key-vals TOMLTABLE) --> int</syntax>
<syntax>(toml-count-arrays TOMLTABLE) --> int</syntax>
<syntax>(toml-count-tables TOMLTABLE) --> int</syntax>
Returns the number of key-value entries, arrays, or tables respectively in {{TOMLTABLE}}.
<syntax>(toml-key-at TOMLTABLE INDEX) --> string</syntax>
Returns the table key at position {{INDEX}} in {{TOMLTABLE}}.
<syntax>(toml-string TOMLTABLE KEY) --> string</syntax>
<syntax>(toml-bool TOMLTABLE KEY) --> bool</syntax>
<syntax>(toml-int TOMLTABLE KEY) --> int</syntax>
<syntax>(toml-double TOMLTABLE KEY) --> double</syntax>
<syntax>(toml-timestamp TOMLTABLE KEY) --> rfc3339</syntax>
<syntax>(toml-array TOMLTABLE KEY) --> <TomlArray></syntax>
<syntax>(toml-table TOMLTABLE KEY) --> <TomlTable></syntax>
Returns the element of the given type in {{TOMLTABLE}} at {{KEY}}.
=== Arrays
<syntax>(toml-self-key TOMLARRAY) --> string</syntax>
Returns the key, if any, to which {{TOMLARRAY}} is assigned.
<syntax>(toml-count-entries TOMLARRAY) --> int</syntax>
Returns the number of entries in {{TOMLARRAY}}.
<syntax>(toml-string TOMLARRAY KEY) --> string</syntax>
<syntax>(toml-bool TOMLARRAY KEY) --> bool</syntax>
<syntax>(toml-int TOMLARRAY KEY) --> int</syntax>
<syntax>(toml-double TOMLARRAY KEY) --> double</syntax>
<syntax>(toml-timestamp TOMLARRAY KEY) --> rfc3339</syntax>
<syntax>(toml-array TOMLARRAY KEY) --> <TomlArray></syntax>
<syntax>(toml-table TOMLARRAY KEY) --> <TomlTable></syntax>
Returns the element of the given type in {{TOMLARRAY}} at {{KEY}}.
== About this egg
=== Authors
Daniel Ziltener
CK Tan
=== Repository
2023-11-24 21:25:34 +00:00
The repository of the Chicken wrapper can be found at [[https://gitea.lyrion.ch/Chicken/toml|https://gitea.lyrion.ch/Chicken/toml]].
2022-10-14 13:20:11 +00:00
The repository of the C implementation being wrapped can be found at [[https://github.com/cktan/tomlc99|https://github.com/cktan/tomlc99]].
=== Version History
2024-03-26 12:58:22 +00:00
; 0.8 : updated the tomlc99 dependency
2022-10-14 13:20:11 +00:00
; 0.7 : fixed an issue with timestamp parsing
; 0.6 : first version of the wrapper
=== License
MIT License
Copyright (c) Daniel Ziltener
https://gitea.lyrion.ch/zilti/toml
Copyright (c) CK Tan
https://github.com/cktan/tomlc99
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.