README 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. Overview and Usage
  2. ------------------
  3. This directory contains Scheme programs, some useful in maintaining Guile.
  4. On "make install", these programs are copied to PKGDATADIR/VERSION/scripts.
  5. You can invoke a program from the shell, or alternatively, load its file
  6. as a Guile Scheme module, and use its exported procedure(s) from Scheme code.
  7. Typically for any PROGRAM:
  8. (use-modules (scripts PROGRAM))
  9. (PROGRAM ARG1 ARG2 ...)
  10. For programs that write to stdout, you might try, instead:
  11. (use-modules (scripts PROGRAM))
  12. (with-output-to-string (lambda () (PROGRAM ARG1 ARG2 ...)))
  13. Note that all args must be strings.
  14. To see PROGRAM's commentary, which may or may not be helpful:
  15. (help (scripts PROGRAM))
  16. To see all commentaries and module dependencies, try: "make overview".
  17. If you want to try the programs before installing Guile, you will probably
  18. need to set environment variable GUILE_LOAD_PATH to be the parent directory.
  19. This can be done in Bourne-compatible shells like so:
  20. GUILE_LOAD_PATH=`(cd .. ; pwd)`
  21. export GUILE_LOAD_PATH
  22. [FIXME: Can someone supply the csh-compatible equivalent?]
  23. How to Contribute
  24. -----------------
  25. See template file PROGRAM for a quick start.
  26. Programs must follow the "executable module" convention, documented here:
  27. - The file name must not end in ".scm".
  28. - The file must be executable (chmod +x).
  29. - The module name must be "(scripts PROGRAM)". A procedure named PROGRAM w/
  30. signature "(PROGRAM . args)" must be exported. Basically, use some variant
  31. of the form:
  32. (define-module (scripts PROGRAM)
  33. :export (PROGRAM))
  34. Feel free to export other definitions useful in the module context.
  35. - There must be the alias:
  36. (define main PROGRAM)
  37. However, `main' must NOT be exported.
  38. - The beginning of the file must use the following invocation sequence:
  39. #!/bin/sh
  40. main='(module-ref (resolve-module '\''(scripts PROGRAM)) '\'main')'
  41. exec ${GUILE-guile} -l $0 -c "(apply $main (cdr (command-line)))" "$@"
  42. !#
  43. Following these conventions allows the program file to be used as module
  44. (scripts PROGRAM) in addition to as a standalone executable. Please also
  45. include a helpful Commentary section w/ some usage info.
  46. [README ends here]