mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 03:40:34 +02:00
Merge remote-tracking branch 'local-2.0/stable-2.0'
Conflicts: meta/Makefile.am
This commit is contained in:
commit
46da7909e1
21 changed files with 202 additions and 55 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -120,7 +120,7 @@ INSTALL
|
|||
/GRTAGS
|
||||
/GSYMS
|
||||
/GTAGS
|
||||
/meta/guile-tools
|
||||
/meta/guild
|
||||
/meta/guile-config
|
||||
/lib/locale.h
|
||||
/module/ice-9/eval.go.stamp
|
||||
|
|
|
@ -28,4 +28,4 @@ SUFFIXES = .scm .go
|
|||
.scm.go:
|
||||
$(AM_V_GUILEC)GUILE_AUTO_COMPILE=0 \
|
||||
$(top_builddir)/meta/uninstalled-env \
|
||||
guile-tools compile $(GUILE_WARNINGS) -o "$@" "$<"
|
||||
guild compile $(GUILE_WARNINGS) -o "$@" "$<"
|
||||
|
|
|
@ -62,6 +62,7 @@ gl_EARLY
|
|||
AC_PROG_CPP
|
||||
AC_PROG_SED
|
||||
AC_PROG_AWK
|
||||
AC_PROG_LN_S
|
||||
|
||||
dnl Gnulib.
|
||||
gl_INIT
|
||||
|
@ -1724,7 +1725,7 @@ GUILE_CONFIG_SCRIPT([benchmark-guile])
|
|||
GUILE_CONFIG_SCRIPT([meta/guile])
|
||||
GUILE_CONFIG_SCRIPT([meta/uninstalled-env])
|
||||
GUILE_CONFIG_SCRIPT([meta/gdb-uninstalled-guile])
|
||||
GUILE_CONFIG_SCRIPT([meta/guile-tools])
|
||||
GUILE_CONFIG_SCRIPT([meta/guild])
|
||||
GUILE_CONFIG_SCRIPT([libguile/guile-snarf])
|
||||
GUILE_CONFIG_SCRIPT([libguile/guile-snarf-docs])
|
||||
GUILE_CONFIG_SCRIPT([test-suite/standalone/test-use-srfi])
|
||||
|
|
|
@ -114,7 +114,7 @@ EXTRA_DIST = ChangeLog-2008 $(PICTURES)
|
|||
|
||||
autoconf.texi: autoconf-macros.texi
|
||||
autoconf-macros.texi: $(top_srcdir)/meta/guile.m4
|
||||
GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guile-tools \
|
||||
GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guild \
|
||||
snarf-guile-m4-docs $(top_srcdir)/meta/guile.m4 \
|
||||
> $(srcdir)/$@
|
||||
|
||||
|
|
|
@ -581,7 +581,7 @@ procedures in this section, for the same reason that it is often bad
|
|||
taste to use @code{eval}. By default, Guile automatically compiles any
|
||||
files it encounters that have not been compiled yet (@pxref{Invoking
|
||||
Guile, @code{--auto-compile}}). The compiler can also be invoked
|
||||
explicitly from the shell as @code{guile-tools compile foo.scm}.
|
||||
explicitly from the shell as @code{guild compile foo.scm}.
|
||||
|
||||
(Why are calls to @code{eval} and @code{compile} usually in bad taste?
|
||||
Because they are limited, in that they can only really make sense for
|
||||
|
@ -603,10 +603,10 @@ For more information on the compiler itself, see @ref{Compiling to the
|
|||
Virtual Machine}. For information on the virtual machine, see @ref{A
|
||||
Virtual Machine for Guile}.
|
||||
|
||||
The command-line interface to Guile's compiler is the @command{guile-tools
|
||||
The command-line interface to Guile's compiler is the @command{guild
|
||||
compile} command:
|
||||
|
||||
@deffn {Command} {guile-tools compile} [@option{option}...] @var{file}...
|
||||
@deffn {Command} {guild compile} [@option{option}...] @var{file}...
|
||||
Compile @var{file}, a source file, and store bytecode in the compilation cache
|
||||
or in the file specified by the @option{-o} option. The following options are
|
||||
available:
|
||||
|
@ -673,7 +673,7 @@ computed by @code{(compiled-file-name @var{file})}.
|
|||
@xref{Compiling to the Virtual Machine}, for more information on these
|
||||
options, and on @var{env} and @var{opts}.
|
||||
|
||||
As with @command{guile-tools compile}, @var{file} is assumed to be
|
||||
As with @command{guild compile}, @var{file} is assumed to be
|
||||
UTF-8-encoded unless it contains a coding declaration.
|
||||
@end deffn
|
||||
|
||||
|
|
|
@ -165,10 +165,11 @@ In Makefile.in:
|
|||
@node Autofrisk
|
||||
@section Autofrisk
|
||||
|
||||
The @dfn{guile-tools autofrisk} command looks for the file @file{modules.af}
|
||||
The @dfn{guild autofrisk} command looks for the file @file{modules.af}
|
||||
in the current directory and writes out @file{modules.af.m4} containing
|
||||
autoconf definitions for @code{AUTOFRISK_CHECKS} and @code{AUTOFRISK_SUMMARY}.
|
||||
@xref{Autoconf Background}, and @xref{Using Autoconf Macros}, for more info.
|
||||
autoconf definitions for @code{AUTOFRISK_CHECKS} and
|
||||
@code{AUTOFRISK_SUMMARY}. @xref{Autoconf Background}, and @xref{Using
|
||||
Autoconf Macros}, for more info.
|
||||
|
||||
The modules.af file consists of a series of configuration forms (Scheme
|
||||
lists), which have one of the following formats:
|
||||
|
@ -238,10 +239,10 @@ Macros}) that does basically the same thing.
|
|||
@end example
|
||||
|
||||
If the SRFI modules (@pxref{SRFI Support}) were a separate package, we could
|
||||
use @code{guile-tools frisk} to find out its dependencies:
|
||||
use @code{guild frisk} to find out its dependencies:
|
||||
|
||||
@example
|
||||
$ guile-tools frisk srfi/*.scm
|
||||
$ guild frisk srfi/*.scm
|
||||
13 files, 18 modules (13 internal, 5 external), 9 edges
|
||||
|
||||
x (ice-9 and-let-star)
|
||||
|
|
|
@ -228,6 +228,7 @@ etc. that make up Guile's application programming interface (API),
|
|||
* Guile Scripting:: How to write Guile scripts.
|
||||
* Using Guile Interactively:: Guile's REPL features.
|
||||
* Using Guile in Emacs:: Guile and Emacs.
|
||||
* Using Guile Tools:: A guild of scheming wizards.
|
||||
@end menu
|
||||
|
||||
@include scheme-intro.texi
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2011
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -332,7 +332,7 @@ An option predicate fails.
|
|||
@end itemize
|
||||
|
||||
@code{#:stop-at-first-non-option} is useful for command line invocations
|
||||
like @code{guile-tools [--help | --version] [script [script-options]]}
|
||||
like @code{guild [--help | --version] [script [script-options]]}
|
||||
and @code{cvs [general-options] command [command-options]}, where there
|
||||
are options at two levels: some generic and understood by the outer
|
||||
command, and some that are specific to the particular script or command
|
||||
|
|
|
@ -695,6 +695,34 @@ See Geiser's web page at @uref{http://www.nongnu.org/geiser/}, for more
|
|||
information.
|
||||
|
||||
|
||||
@node Using Guile Tools
|
||||
@section Using Guile Tools
|
||||
|
||||
@cindex guild
|
||||
@cindex guile-tools
|
||||
@cindex wizards
|
||||
Guile also comes with a growing number of command-line utilities: a
|
||||
compiler, a disassembler, some module inspectors, and in the future, a
|
||||
system to install Guile packages from the internet. These tools may be
|
||||
invoked using the @code{guild} program.
|
||||
|
||||
@example
|
||||
$ guild compile -o foo.go foo.scm
|
||||
wrote `foo.go'
|
||||
@end example
|
||||
|
||||
This program used to be called @code{guile-tools}, and for backward
|
||||
compatibility it still may be called as such. However we changed the
|
||||
name to @code{guild}, not only because it is pleasantly shorter and
|
||||
easier to read, but also because this tool will serve to bind Guile
|
||||
wizards together, by allowing hackers to share code with each other
|
||||
using a CPAN-like system.
|
||||
|
||||
@xref{Compilation}, for more on @code{guild compile}.
|
||||
|
||||
A complete list of guild scripts can be had by invoking @code{guild
|
||||
list}, or simply @code{guild}.
|
||||
|
||||
@c Local Variables:
|
||||
@c TeX-master: "guile.texi"
|
||||
@c End:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@c -*-texinfo-*-
|
||||
@c This is part of the GNU Guile Reference Manual.
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004
|
||||
@c Copyright (C) 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2011
|
||||
@c Free Software Foundation, Inc.
|
||||
@c See the file guile.texi for copying conditions.
|
||||
|
||||
|
@ -9,13 +9,13 @@
|
|||
@chapter Miscellaneous Tools
|
||||
|
||||
Programming is more fun with a good tools. This chapter describes snarfing
|
||||
tools, and the @code{guile-tools} program which can be used to invoke the rest
|
||||
tools, and the @code{guild} program which can be used to invoke the rest
|
||||
of the tools (which are self-documenting). Some of these are used in Guile
|
||||
development, too. Imagine that!
|
||||
|
||||
@menu
|
||||
* Snarfing:: Grepping the source in various ways.
|
||||
* Executable Modules:: Modules callable via guile-tools.
|
||||
* Executable Modules:: Modules callable via guild.
|
||||
@end menu
|
||||
|
||||
@c ---------------------------------------------------------------------------
|
||||
|
@ -298,26 +298,27 @@ is rather byzantine, so for now @emph{NO} doc snarfing programs are installed.
|
|||
@c ---------------------------------------------------------------------------
|
||||
@node Executable Modules
|
||||
@section Executable Modules
|
||||
@cindex guild
|
||||
@cindex guile-tools
|
||||
@cindex modules, executable
|
||||
@cindex executable modules
|
||||
@cindex scripts
|
||||
|
||||
When Guile is installed, in addition to the @code{(ice-9 FOO)} modules, a set
|
||||
of @dfn{guile-tools modules} @code{(scripts BAR)} is also installed. Each is
|
||||
of @dfn{guild modules} @code{(scripts BAR)} is also installed. Each is
|
||||
a regular Scheme module that has some additional packaging so that it can be
|
||||
used by guile-tools, from the shell. For this reason, we sometimes use the
|
||||
used by guild, from the shell. For this reason, we sometimes use the
|
||||
term @dfn{script} in this context to mean the same thing.
|
||||
|
||||
As a convenience, the @code{guile-tools} wrapper program is installed along w/
|
||||
As a convenience, the @code{guild} wrapper program is installed along w/
|
||||
@code{guile}; it knows where a particular module is installed and calls it
|
||||
passing its args to the program. The result is that you need not augment your
|
||||
PATH. Usage is straightforward:
|
||||
|
||||
@example
|
||||
guile-tools --help
|
||||
guile-tools --version
|
||||
guile-tools [OPTION] PROGRAM [ARGS ...]
|
||||
guild --help
|
||||
guild --version
|
||||
guild [OPTION] PROGRAM [ARGS ...]
|
||||
|
||||
If PROGRAM is "list" or omitted, display contents of scripts dir, otherwise
|
||||
PROGRAM is run w/ ARGS. Options (only one of which may be used at a time):
|
||||
|
@ -330,8 +331,8 @@ The modules are self-documenting. For example, to see the documentation for
|
|||
@code{lint}, use one (or both) of the shell commands:
|
||||
|
||||
@example
|
||||
guile-tools display-commentary '(scripts lint)'
|
||||
guile-tools --source lint
|
||||
guild display-commentary '(scripts lint)'
|
||||
guild --source lint
|
||||
@end example
|
||||
|
||||
The rest of this section describes the packaging that goes into creating an
|
||||
|
@ -343,7 +344,7 @@ executable module. Feel free to skip to the next chapter.
|
|||
|
||||
See template file @code{PROGRAM} for a quick start.
|
||||
|
||||
Programs must follow the @dfn{guile-tools} convention, documented here:
|
||||
Programs must follow the @dfn{guild} convention, documented here:
|
||||
|
||||
@itemize
|
||||
|
||||
|
@ -371,7 +372,7 @@ However, `main' must NOT be exported.
|
|||
@end itemize
|
||||
|
||||
Following these conventions allows the program file to be used as module
|
||||
@code{(scripts PROGRAM)} in addition to being invoked by guile-tools. Please
|
||||
@code{(scripts PROGRAM)} in addition to being invoked by guild. Please
|
||||
also include a helpful Commentary section w/ some usage info.
|
||||
|
||||
@c tools.texi ends here
|
||||
|
|
|
@ -698,7 +698,7 @@ posix.x: cpp-SIG.c
|
|||
load.x: libpath.h
|
||||
|
||||
alldotdocfiles = $(DOT_DOC_FILES) $(EXTRA_DOT_DOC_FILES)
|
||||
snarf2checkedtexi = GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guile-tools snarf-check-and-output-texi
|
||||
snarf2checkedtexi = GUILE_AUTO_COMPILE=0 $(top_builddir)/meta/uninstalled-env guild snarf-check-and-output-texi
|
||||
dotdoc2texi = cat $(alldotdocfiles) | $(snarf2checkedtexi)
|
||||
|
||||
guile.texi: $(alldotdocfiles) guile$(EXEEXT)
|
||||
|
|
|
@ -275,6 +275,9 @@ void scm_ia64_longjmp (scm_i_jmp_buf *, int);
|
|||
/* The objcode magic header. */
|
||||
#define SCM_OBJCODE_COOKIE \
|
||||
"GOOF----" SCM_OBJCODE_MACHINE_VERSION_STRING
|
||||
#define SCM_OBJCODE_ENDIANNESS_OFFSET 8
|
||||
#define SCM_OBJCODE_WORD_SIZE_OFFSET 11
|
||||
|
||||
|
||||
#endif /* SCM__SCM_H */
|
||||
|
||||
|
|
|
@ -324,10 +324,38 @@ SCM_DEFINE (scm_write_objcode, "write-objcode", 2, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_write_objcode
|
||||
{
|
||||
static SCM target_endianness_var = SCM_BOOL_F;
|
||||
static SCM target_word_size_var = SCM_BOOL_F;
|
||||
|
||||
char cookie[sizeof (SCM_OBJCODE_COOKIE) - 1];
|
||||
char endianness;
|
||||
char word_size;
|
||||
|
||||
SCM_VALIDATE_OBJCODE (1, objcode);
|
||||
SCM_VALIDATE_OUTPUT_PORT (2, port);
|
||||
|
||||
scm_c_write (port, SCM_OBJCODE_COOKIE, strlen (SCM_OBJCODE_COOKIE));
|
||||
if (scm_is_false (target_endianness_var))
|
||||
target_endianness_var =
|
||||
scm_c_public_variable ("system base target", "target-endianness");
|
||||
if (scm_is_false (target_word_size_var))
|
||||
target_word_size_var =
|
||||
scm_c_public_variable ("system base target", "target-word-size");
|
||||
|
||||
endianness =
|
||||
scm_is_eq (scm_call_0 (scm_variable_ref (target_endianness_var)),
|
||||
scm_endianness_big) ? 'B' : 'L';
|
||||
switch (scm_to_int (scm_call_0 (scm_variable_ref (target_word_size_var))))
|
||||
{
|
||||
case 4: word_size = '4'; break;
|
||||
case 8: word_size = '8'; break;
|
||||
default: abort ();
|
||||
}
|
||||
|
||||
memcpy (cookie, SCM_OBJCODE_COOKIE, strlen (SCM_OBJCODE_COOKIE));
|
||||
cookie[SCM_OBJCODE_ENDIANNESS_OFFSET] = endianness;
|
||||
cookie[SCM_OBJCODE_WORD_SIZE_OFFSET] = word_size;
|
||||
|
||||
scm_c_write (port, cookie, strlen (SCM_OBJCODE_COOKIE));
|
||||
scm_c_write (port, SCM_OBJCODE_DATA (objcode),
|
||||
sizeof (struct scm_objcode) + SCM_OBJCODE_TOTAL_LEN (objcode));
|
||||
|
||||
|
|
|
@ -20,11 +20,16 @@
|
|||
## write to the Free Software Foundation, Inc., 51 Franklin Street,
|
||||
## Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
bin_SCRIPTS = guile-config guile-tools
|
||||
bin_SCRIPTS = guile-config guild
|
||||
EXTRA_DIST= \
|
||||
guile.m4 ChangeLog-2008 \
|
||||
guile-2.2.pc.in guile-2.2-uninstalled.pc.in \
|
||||
guile-tools.in guile-config.in
|
||||
guild.in guile-config.in
|
||||
|
||||
# What we now call `guild' used to be known as `guile-tools'.
|
||||
install-data-hook:
|
||||
cd $(DESTDIR)$(bindir) && rm -f guile-tools$(EXEEXT) && \
|
||||
$(LN_S) guild$(EXEEXT) guile-tools$(EXEEXT)
|
||||
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = guile-2.2.pc
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
# -*- scheme -*-
|
||||
exec guile $GUILE_FLAGS -e '(@@ (guile-tools) main)' -s "$0" "$@"
|
||||
exec guile $GUILE_FLAGS -e '(@@ (guild) main)' -s "$0" "$@"
|
||||
!#
|
||||
|
||||
;;;; guile-tools --- running scripts bundled with Guile
|
||||
;;;; guild --- running scripts bundled with Guile
|
||||
;;;; Andy Wingo <wingo@pobox.com> --- April 2009
|
||||
;;;;
|
||||
;;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
|
@ -23,7 +23,7 @@ exec guile $GUILE_FLAGS -e '(@@ (guile-tools) main)' -s "$0" "$@"
|
|||
;;;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
;;;; Boston, MA 02110-1301 USA
|
||||
|
||||
(define-module (guile-tools)
|
||||
(define-module (guild)
|
||||
#:use-module (ice-9 getopt-long)
|
||||
#:autoload (ice-9 format) (format))
|
||||
|
||||
|
@ -39,16 +39,16 @@ exec guile $GUILE_FLAGS -e '(@@ (guile-tools) main)' -s "$0" "$@"
|
|||
|
||||
(define (display-help)
|
||||
(display "\
|
||||
Usage: guile-tools --version
|
||||
guile-tools --help
|
||||
guile-tools PROGRAM [ARGS]
|
||||
Usage: guild --version
|
||||
guild --help
|
||||
guild PROGRAM [ARGS]
|
||||
|
||||
If PROGRAM is \"list\" or omitted, display available scripts, otherwise
|
||||
PROGRAM is run with ARGS.
|
||||
"))
|
||||
|
||||
(define (display-version)
|
||||
(format #t "guile-tools (GNU Guile ~A) ~A
|
||||
(format #t "guild (GNU Guile ~A) ~A
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
License LGPLv3+: GNU LGPL version 3 or later <http://gnu.org/licenses/lgpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
|
@ -82,7 +82,7 @@ There is NO WARRANTY, to the extent permitted by law.
|
|||
(cdr args))))))
|
||||
(else
|
||||
(format (current-error-port)
|
||||
"guile-tools: unknown script ~s~%" (car args))
|
||||
"guild: unknown script ~s~%" (car args))
|
||||
(format (current-error-port)
|
||||
"Try `guile-tools --help' for more information.~%")
|
||||
"Try `guild --help' for more information.~%")
|
||||
(exit 1))))))))
|
|
@ -82,7 +82,7 @@ ice-9/psyntax-pp.scm.gen:
|
|||
ice-9/psyntax-pp.go: ice-9/psyntax.scm ice-9/psyntax-pp.scm
|
||||
$(AM_V_GUILEC) GUILE_AUTO_COMPILE=0 \
|
||||
$(top_builddir)/meta/uninstalled-env \
|
||||
guile-tools compile $(GUILE_WARNINGS) -o "ice-9/psyntax-pp.go" "$(srcdir)/ice-9/psyntax.scm"
|
||||
guild compile $(GUILE_WARNINGS) -o "ice-9/psyntax-pp.go" "$(srcdir)/ice-9/psyntax.scm"
|
||||
|
||||
SCHEME_LANG_SOURCES = \
|
||||
language/scheme/spec.scm \
|
||||
|
@ -173,7 +173,8 @@ SYSTEM_BASE_SOURCES = \
|
|||
system/base/compile.scm \
|
||||
system/base/language.scm \
|
||||
system/base/lalr.scm \
|
||||
system/base/message.scm
|
||||
system/base/message.scm \
|
||||
system/base/target.scm
|
||||
|
||||
ICE_9_SOURCES = \
|
||||
ice-9/r4rs.scm \
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
(define-module (language assembly compile-bytecode)
|
||||
#:use-module (system base pmatch)
|
||||
#:use-module (system base target)
|
||||
#:use-module (language assembly)
|
||||
#:use-module (system vm instruction)
|
||||
#:use-module (rnrs bytevectors)
|
||||
|
@ -38,7 +39,7 @@
|
|||
((_ arg)
|
||||
(begin body body* ...)))))))
|
||||
|
||||
(define (fill-bytecode bv)
|
||||
(define (fill-bytecode bv target-endianness)
|
||||
(let ((pos 0))
|
||||
(define-inline1 (write-byte b)
|
||||
(bytevector-u8-set! bv pos b)
|
||||
|
@ -54,7 +55,7 @@
|
|||
(bytevector-u32-set! bv pos x (endianness big))
|
||||
(set! pos (+ pos 4)))
|
||||
(define-inline1 (write-uint32 x)
|
||||
(bytevector-u32-native-set! bv pos x)
|
||||
(bytevector-u32-set! bv pos x target-endianness)
|
||||
(set! pos (+ pos 4)))
|
||||
(define-inline1 (write-loader-len len)
|
||||
(bytevector-u8-set! bv pos (ash len -16))
|
||||
|
@ -77,7 +78,7 @@
|
|||
(bytevector-copy! bv* 0 bv pos len)
|
||||
(set! pos (+ pos len))))
|
||||
(define-inline1 (write-wide-string s)
|
||||
(write-bytevector (string->utf32 s (native-endianness))))
|
||||
(write-bytevector (string->utf32 s target-endianness)))
|
||||
(define-inline1 (write-break label)
|
||||
(let ((offset (- (assq-ref labels label) (+ (get-addr) 3))))
|
||||
(cond ((>= offset (ash 1 23)) (error "jump too far forward" offset))
|
||||
|
@ -160,6 +161,7 @@
|
|||
(fill-bytecode (make-bytevector (+ 4 4 length
|
||||
(if meta
|
||||
(1- (byte-length meta))
|
||||
0)))))
|
||||
0)))
|
||||
(target-endianness)))
|
||||
|
||||
(else (error "bad assembly" assembly))))
|
||||
|
|
|
@ -4,7 +4,7 @@ Overview and Usage
|
|||
This directory contains Scheme programs, some useful in maintaining Guile.
|
||||
On "make install", these programs are copied to PKGDATADIR/VERSION/scripts.
|
||||
|
||||
You can use guile-tools to invoke a program from the shell, or alternatively,
|
||||
You can use guild to invoke a program from the shell, or alternatively,
|
||||
load its file as a Guile Scheme module, and use its exported procedure(s)
|
||||
from Scheme code. Typically for any PROGRAM:
|
||||
|
||||
|
@ -38,7 +38,7 @@ How to Contribute
|
|||
|
||||
See template file PROGRAM for a quick start.
|
||||
|
||||
Programs must follow the "guile-tools" convention, documented here:
|
||||
Programs must follow the "guild" convention, documented here:
|
||||
|
||||
- The module name must be "(scripts PROGRAM)". A procedure named PROGRAM w/
|
||||
signature "(PROGRAM . args)" must be exported. Basically, use some variant
|
||||
|
@ -56,7 +56,7 @@ Programs must follow the "guile-tools" convention, documented here:
|
|||
However, `main' must NOT be exported.
|
||||
|
||||
Following these conventions allows the program file to be used as module
|
||||
(scripts PROGRAM) in addition to being invoked by guile-tools. Please also
|
||||
(scripts PROGRAM) in addition to being invoked by guild. Please also
|
||||
include a helpful Commentary section w/ some usage info.
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;;; lint --- Preemptive checks for coding errors in Guile Scheme code
|
||||
|
||||
;; Copyright (C) 2002, 2006 Free Software Foundation, Inc.
|
||||
;; Copyright (C) 2002, 2006, 2011 Free Software Foundation, Inc.
|
||||
;;
|
||||
;; This program is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU Lesser General Public License
|
||||
|
@ -64,7 +64,7 @@
|
|||
;; Note: most of the unresolved variables found in this example are
|
||||
;; false positives, as you would hope. => scope for improvement.
|
||||
;;
|
||||
;; $ guile-tools lint `guile-tools`
|
||||
;; $ guild lint `guild`
|
||||
;; No unresolved free variables in PROGRAM
|
||||
;; No unresolved free variables in autofrisk
|
||||
;; No unresolved free variables in display-commentary
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;; List --- List scripts that can be invoked by guile-tools -*- coding: iso-8859-1 -*-
|
||||
;;; List --- List scripts that can be invoked by guild -*- coding: iso-8859-1 -*-
|
||||
|
||||
;;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
|
||||
;;;;
|
||||
|
@ -21,7 +21,7 @@
|
|||
|
||||
;; Usage: list
|
||||
;;
|
||||
;; List scripts that can be invoked by guile-tools.
|
||||
;; List scripts that can be invoked by guild.
|
||||
|
||||
;;; Code:
|
||||
|
||||
|
|
76
module/system/base/target.scm
Normal file
76
module/system/base/target.scm
Normal file
|
@ -0,0 +1,76 @@
|
|||
;;; Compilation targets
|
||||
|
||||
;; Copyright (C) 2011 Free Software Foundation, Inc.
|
||||
|
||||
;; This library is free software; you can redistribute it and/or
|
||||
;; modify it under the terms of the GNU Lesser General Public
|
||||
;; License as published by the Free Software Foundation; either
|
||||
;; version 3 of the License, or (at your option) any later version.
|
||||
;;
|
||||
;; This library is distributed in the hope that it will be useful,
|
||||
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
;; Lesser General Public License for more details.
|
||||
;;
|
||||
;; You should have received a copy of the GNU Lesser General Public
|
||||
;; License along with this library; if not, write to the Free Software
|
||||
;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
;; 02110-1301 USA
|
||||
|
||||
;;; Code:
|
||||
|
||||
(define-module (system base target)
|
||||
#:use-module (rnrs bytevectors)
|
||||
#:export (target-type with-target
|
||||
|
||||
target-cpu target-vendor target-os
|
||||
|
||||
target-endianness target-word-size))
|
||||
|
||||
|
||||
|
||||
;;;
|
||||
;;; Target types
|
||||
;;;
|
||||
|
||||
(define %target-type (make-fluid))
|
||||
|
||||
(define (target-type)
|
||||
(or (fluid-ref %target-type)
|
||||
%host-type))
|
||||
|
||||
(define (validate-target target)
|
||||
(if (or (not (string? target))
|
||||
(let ((parts (string-split target #\-)))
|
||||
(or (< 3 (length parts))
|
||||
(or-map string-null? parts))))
|
||||
(error "invalid target" target)))
|
||||
|
||||
(define (with-target target thunk)
|
||||
(validate-target target)
|
||||
(with-fluids ((%target-type target))
|
||||
(thunk)))
|
||||
|
||||
(define (target-cpu)
|
||||
(let ((t (target-type)))
|
||||
(substring t 0 (string-index t #\-))))
|
||||
|
||||
(define (target-vendor)
|
||||
(let* ((t (target-type))
|
||||
(start (1+ (string-index t #\-))))
|
||||
(substring t start (string-index t #\- start))))
|
||||
|
||||
(define (target-os)
|
||||
(let* ((t (target-type))
|
||||
(start (1+ (string-index t #\- (1+ (string-index t #\-))))))
|
||||
(substring t start)))
|
||||
|
||||
(define (target-endianness)
|
||||
(if (equal? (target-type) %host-type)
|
||||
(native-endianness)
|
||||
(error "cross-compilation not yet handled" %host-type (target-type))))
|
||||
|
||||
(define (target-word-size)
|
||||
(if (equal? (target-type) %host-type)
|
||||
((@ (system foreign) sizeof) '*)
|
||||
(error "cross-compilation not yet handled" %host-type (target-type))))
|
Loading…
Add table
Add a link
Reference in a new issue