summaryrefslogtreecommitdiff
path: root/devdocs/gnu_make/guile-types.html
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
committerCraig Jennings <c@cjennings.net>2024-04-07 13:41:34 -0500
commit754bbf7a25a8dda49b5d08ef0d0443bbf5af0e36 (patch)
treef1190704f78f04a2b0b4c977d20fe96a828377f1 /devdocs/gnu_make/guile-types.html
new repository
Diffstat (limited to 'devdocs/gnu_make/guile-types.html')
-rw-r--r--devdocs/gnu_make/guile-types.html15
1 files changed, 15 insertions, 0 deletions
diff --git a/devdocs/gnu_make/guile-types.html b/devdocs/gnu_make/guile-types.html
new file mode 100644
index 00000000..6fc24a38
--- /dev/null
+++ b/devdocs/gnu_make/guile-types.html
@@ -0,0 +1,15 @@
+ <h1 class="subsection">Conversion of Guile Types</h1> <p>There is only one “data type” in <code>make</code>: a string. GNU Guile, on the other hand, provides a rich variety of different data types. An important aspect of the interface between <code>make</code> and GNU Guile is the conversion of Guile data types into <code>make</code> strings. </p> <p>This conversion is relevant in two places: when a makefile invokes the <code>guile</code> function to evaluate a Guile expression, the result of that evaluation must be converted into a make string so it can be further evaluated by <code>make</code>. And secondly, when a Guile script invokes one of the procedures exported by <code>make</code> the argument provided to the procedure must be converted into a string. </p> <p>The conversion of Guile types into <code>make</code> strings is as below: </p> <dl compact> <dt id="#f"><code>#f</code></dt> <dd>
+<p>False is converted into the empty string: in <code>make</code> conditionals the empty string is considered false. </p> </dd> <dt id="#t"><code>#t</code></dt> <dd>
+<p>True is converted to the string ‘<samp>#t</samp>’: in <code>make</code> conditionals any non-empty string is considered true. </p> </dd> <dt id="symbol"><code>symbol</code></dt> <dt id="number"><code>number</code></dt> <dd>
+<p>A symbol or number is converted into the string representation of that symbol or number. </p> </dd> <dt id="character"><code>character</code></dt> <dd>
+<p>A printable character is converted to the same character. </p> </dd> <dt id="string"><code>string</code></dt> <dd>
+<p>A string containing only printable characters is converted to the same string. </p> </dd> <dt id="list"><code>list</code></dt> <dd>
+<p>A list is converted recursively according to the above rules. This implies that any structured list will be flattened (that is, a result of ‘<samp>'(a b (c d) e)</samp>’ will be converted to the <code>make</code> string ‘<samp>a b c d e</samp>’). </p> </dd> <dt id="other"><code>other</code></dt> <dd>
+<p>Any other Guile type results in an error. In future versions of <code>make</code>, other Guile types may be converted. </p> </dd> </dl> <p>The translation of ‘<samp>#f</samp>’ (to the empty string) and ‘<samp>#t</samp>’ (to the non-empty string ‘<samp>#t</samp>’) is designed to allow you to use Guile boolean results directly as <code>make</code> boolean conditions. For example: </p> <div class="example"> <pre class="example">$(if $(guile (access? "myfile" R_OK)),$(info myfile exists))
+</pre>
+</div> <p>As a consequence of these conversion rules you must consider the result of your Guile script, as that result will be converted into a string and parsed by <code>make</code>. If there is no natural result for the script (that is, the script exists solely for its side-effects), you should add ‘<samp>#f</samp>’ as the final expression in order to avoid syntax errors in your makefile. </p><div class="_attribution">
+ <p class="_attribution-p">
+ Copyright © 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021, 2022 Free Software Foundation, Inc. <br>Licensed under the GNU Free Documentation License.<br>
+ <a href="https://www.gnu.org/software/make/manual/html_node/Guile-Types.html" class="_attribution-link">https://www.gnu.org/software/make/manual/html_node/Guile-Types.html</a>
+ </p>
+</div>