X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=docs%2FGoalfile.pod;h=93ca2255bab0b2d8e800d812bb821dcbcc95c648;hb=0c83549ca2d42c26c0c9c2c5164247927d284adc;hp=f586ec409dd6b7bccba7b04f922b1360c731aa96;hpb=692f7e7a70572c5f4f7242ce721a674a75b34e06;p=goals.git diff --git a/docs/Goalfile.pod b/docs/Goalfile.pod index f586ec4..93ca225 100644 --- a/docs/Goalfile.pod +++ b/docs/Goalfile.pod @@ -12,6 +12,20 @@ Goalfile - introduction, tutorial, and reference for writing goal files =head1 REFERENCE +=head2 Standard Variables + +=head3 %stdlib + +The path to the standard library directory. This path is also +searched by default for C directives. + +=head3 %tmpdir + +The location of a temporary directory which is created by goals when +it starts and is deleted when it exits (either on success or failure). +You can use this to store any temporary files that you want +automatically cleaned up. + =head2 Standard Functions =head3 basename (path) @@ -132,6 +146,20 @@ For example: This takes a list of strings and sorts it, removing duplicates. +=head3 split (string) + +For example: + + split ("-g -O2") ⇒ ["-g", "-O2"] + +Split a string using shell rules into a list of strings. This is +commonly used for splitting C provided by autoconf into a list +for use by goals: + + let CFLAGS = split ("@CFLAGS@") + goal compile (name) = + "%name.o" : "%name.c" { %CC %CFLAGS -c %< -o %@ } + =head3 subst (from, to, text) For example: @@ -164,13 +192,31 @@ files using ordinary globbing rules. For example: - wrap ("*file", ["bar.c", "foo.c"]) ⇒ [*file("bar.c"), *file("foo.c")] + wrap ("is-file", ["bar.c", "foo.c"]) ⇒ [is-file("bar.c"), is-file("foo.c")] Each element in C is wrapped into a call to C. -There are two common uses for this: either to add explicit tactics -(such as C<*file>) to a plain list of strings as in the example above; +There are two common uses for this: either to add explicit predicates +(such as C) to a plain list of strings as in the example above; or to turn a list of strings into a list of goal or function calls. +=head2 Standard Shell Functions + +=head3 quoted_string + +Quote a string which will be consumed as a goal expression. This is +typically used from within goal functions which return expressions +(ie. ones which do I have an explicit C declaration). +You must not use this shell function with functions that are marked as +C or C. + +=head3 print_green + +Echo a string in green. Useful for success/OK messages. + +=head3 print_red + +Echo a string in red. Useful for error messages. + =head1 SEE ALSO L.