1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
@node Module Introspection
@chapter Guile Module Introspection
These are various procedures for getting information about modules,
usually in a static (only looking at ``dead'' source code) way. They
are currently strewn about a couple files, all under
@file{hnh/module-introspection}.
TODO rework the file structure.
TODO the all-*-under-directory procedures really need to be
straightened out.
@defun module-uses* forms
Find all dependencies of a module by statically analyzing its source code.
It gives worse resluts than Guile's built in @code{module-uses}, but
has the benefit that a module which doesn't compile can still be checked.
@var{froms} should be a list gotten by repeateadly calling @code{read}
on a Scheme source file.
The return value is a list of sublists, where the car of each list is
the module's name (for example @code{(ice-9 format)}), and the cdr
being a keyword tagged list with the following tags and types,
corresponding to @code{use-modules} parameters.
@table @samp
@item #:select
List of imported symbols, present if only a subset of the exported
symbols are imported.
@item #:hide
List of symbols removed from the import. Always present, but may be an
empty list if nothing was hidden.
@item #:prefix
A symbol which prefixes all imported symbols.
@item #:renamer
literally what is written.
@item #:version
A list of exact integers.
@end table
Note that if the module was imported multiple times then it will be
present multiple times in the list, possibly with different options.
@end defun
@defun unique-symbols tree
Return a list of all symbols occuring in @var{tree}. Each symbol is
noted exactly once, anything which isn't a symbol is discarded.
@end defun
@defun module-declaration? form
Checks if @var{form} starts with @code{'define-module}.
@end defun
@defun find-module-declaration forms
@anchor{find-module-declaration}
In a list of forms, find the first one which satisfies @code{module-declarations?}.
@end defun
@defun get-forms port
Repeatadly call @code{read} on @var{port}, and return a list of the
read forms in order of occurence in the file.
@end defun
@defun all-files-and-modules-under-directory dir
Like @code{all-modules-under-directory}, but returns 2-lists of
filename + module name.
@end defun
@defun all-files-under-directory directory extension
Return a flat list of all ``regular'' files under @var{directory},
whose end in @var{extension}.
@example
(all-files-under-directory "module" ".scm)
⇒ '("module/hnh/util.scm")
@end example
@end defun
@defun all-modules-under-directory directory
Finds all ``.scm'' files under @var{directory}, and then read them to
find a module declaration (@pxref{find-module-declaration}). Returns both
the list of all the files, as well as all modules found, as a list of
module lists, each one suitable to be sent to
@code{reslove-interface}.
Scheme files without a module declaration are not included in the
result.
@end defun
@defun fs-find dir
Find all files under @var{dir}. This includes all file types,
including directories.
@example
(fs-find "module")
;; Would return something on the following form:
⇒ `(("module/hnh/util.scm" ,(stat "module/hnh/util.scm") regular)
("module/hnh" ,(stat "module/hnh") directory)
("module" ,(stat "module") directory)
...)
@end example
@end defun
@defun module-file-mapping dir
@end defun
|