~rdoering/ubuntu/intrepid/erlang/fix-535090

« back to all changes in this revision

Viewing changes to lib/edoc/src/edoc.erl

  • Committer: Bazaar Package Importer
  • Author(s): Soren Hansen
  • Date: 2007-05-01 16:57:10 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: james.westby@ubuntu.com-20070501165710-2sapk0hp2gf3o0ip
Tags: 1:11.b.4-2ubuntu1
* Merge with Debian Unstable. Remaining changes:
  - Add -fno-stack-protector to fix broken crypto_drv.
* DebianMaintainerField update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
%%
17
17
%% $Id$
18
18
%%
19
 
%% @copyright 2001-2003 Richard Carlsson
20
 
%% @author Richard Carlsson <richardc@csd.uu.se>
21
 
%%   [http://www.csd.uu.se/~richardc/]
22
 
%% @version {@vsn}
 
19
%% @copyright 2001-2007 Richard Carlsson
 
20
%% @author Richard Carlsson <richardc@it.uu.se>
 
21
%% @version {@version}
23
22
%% @end
24
23
%% =====================================================================
25
24
 
26
 
%% @TODO check weirdness in name generation for @spec f(TypeName, ...) -> ...
27
 
%% @TODO option for ignoring functions matching some pattern ('..._test_'/0)
28
 
%% @TODO @private_type tag, opaque unless generating private docs?
29
 
%% @TODO document the record type syntax
30
 
%% @TODO document the @docfile and @headerfile tags, with includes-option
31
 
%% @TODO some 'skip' option for ignoring particular modules/packages?
32
 
%% @TODO intermediate-level packages: document even if no local sources.
33
 
%% @TODO multiline comment support (needs modified comment representation)
34
 
%% @TODO config-file for default settings
35
 
%% @TODO config: locations of all local docdirs; generate local doc-index page
36
 
%% @TODO config: URL:s of offline packages/apps
37
 
%% @TODO config: default stylesheet
38
 
%% @TODO config: default header/footer, etc.
39
 
%% @TODO offline linkage
 
25
%% TODO: check weirdness in name generation for @spec f(TypeName, ...) -> ...
 
26
%% TODO: option for ignoring functions matching some pattern ('..._test_'/0)
 
27
%% TODO: @private_type tag, opaque unless generating private docs?
 
28
%% TODO: document the record type syntax
 
29
%% TODO: some 'skip' option for ignoring particular modules/packages?
 
30
%% TODO: intermediate-level packages: document even if no local sources.
 
31
%% TODO: multiline comment support (needs modified comment representation)
 
32
%% TODO: config-file for default settings
 
33
%% TODO: config: locations of all local docdirs; generate local doc-index page
 
34
%% TODO: config: URL:s of offline packages/apps
 
35
%% TODO: config: default stylesheet
 
36
%% TODO: config: default header/footer, etc.
 
37
%% TODO: offline linkage
 
38
%% TODO: including source code, explicitly and/or automatically
40
39
 
41
40
%% @doc EDoc - the Erlang program documentation generator.
42
41
%%
43
42
%% This module provides the main user interface to EDoc.
44
43
%% <ul>
45
44
%%   <li><a href="overview-summary.html">EDoc User Manual</a></li>
46
 
%%   <li><a href="overview-summary.html#usage">Running EDoc</a></li>
 
45
%%   <li><a href="overview-summary.html#Running_EDoc">Running EDoc</a></li>
47
46
%% </ul>
48
47
 
49
48
-module(edoc).
71
70
file(Name) ->
72
71
    file(Name, []).
73
72
 
74
 
%% @spec file(filename(), option_list()) -> ok 
 
73
%% @spec file(filename(), proplist()) -> ok 
75
74
%%
76
75
%% @type filename() = //kernel/file:filename()
77
 
%% @type option_list() = [term()]
 
76
%% @type proplist() = [term()]
78
77
%%
79
78
%% @deprecated This is part of the old interface to EDoc and is mainly
80
79
%% kept for backwards compatibility. The preferred way of generating
126
125
    edoc_lib:write_file(Text, Dir, BaseName ++ Suffix).
127
126
 
128
127
 
129
 
%% @TODO better documentation of files/1/2, packages/1/2, application/1/2/3
 
128
%% TODO: better documentation of files/1/2, packages/1/2, application/1/2/3
130
129
 
131
130
%% @spec (Files::[filename() | {package(), [filename()]}]) -> ok
132
131
%% @equiv packages(Packages, [])
135
134
    files(Files, []).
136
135
 
137
136
%% @spec (Files::[filename() | {package(), [filename()]}],
138
 
%%        Options::option_list()) -> ok
 
137
%%        Options::proplist()) -> ok
139
138
%% @doc Runs EDoc on a given set of source files. See {@link run/3} for
140
 
%% details.
 
139
%% details, including options.
141
140
%% @equiv run([], Files, Options)
142
141
 
143
142
files(Files, Options) ->
149
148
packages(Packages) ->
150
149
    packages(Packages, []).
151
150
 
152
 
%% @spec (Packages::[package()], Options::option_list()) -> ok
 
151
%% @spec (Packages::[package()], Options::proplist()) -> ok
153
152
%% @type package() = atom() | string()
154
153
%%
155
154
%% @doc Runs EDoc on a set of packages. The `source_path' option is used
156
 
%% to locate the files; see {@link run/3} for details. This function
157
 
%% automatically appends the current directory to the source path.
 
155
%% to locate the files; see {@link run/3} for details, including
 
156
%% options. This function automatically appends the current directory to
 
157
%% the source path.
158
158
%%
159
159
%% @equiv run(Packages, [], Options)
160
160
 
167
167
application(App) ->
168
168
    application(App, []).
169
169
 
170
 
%% @spec (Application::atom(), Options::option_list()) -> ok
 
170
%% @spec (Application::atom(), Options::proplist()) -> ok
171
171
%% @doc Run EDoc on an application in its default app-directory. See
172
172
%% {@link application/3} for details.
173
173
%% @see application/1
182
182
            exit(error)
183
183
    end.
184
184
 
185
 
%% @spec (Application::atom(), Dir::filename(), Options::option_list())
 
185
%% @spec (Application::atom(), Dir::filename(), Options::proplist())
186
186
%%        -> ok
187
187
%% @doc Run EDoc on an application located in the specified directory.
188
188
%% Tries to automatically set up good defaults. Unless the user
204
204
%%   </li>
205
205
%% </ul>
206
206
%%
207
 
%% See {@link run/3} for details.
 
207
%% See {@link run/3} for details, including options.
208
208
%%
209
209
%% @see application/2
210
210
 
260
260
 
261
261
%% @spec run(Packages::[package()],
262
262
%%           Files::[filename() | {package(), [filename()]}],
263
 
%%           Options::option_list()) -> ok
 
263
%%           Options::proplist()) -> ok
264
264
%% @doc Runs EDoc on a given set of source files and/or packages. Note
265
265
%% that the doclet plugin module has its own particular options; see the
266
266
%% `doclet' option below.
267
267
%% 
268
 
%% Also see {@link edoc:layout/2} for layout-related options, and
269
 
%% {@link edoc:get_doc/2} for options related to reading source
 
268
%% Also see {@link layout/2} for layout-related options, and
 
269
%% {@link get_doc/2} for options related to reading source
270
270
%% files.
271
271
%%
272
272
%% Options:
524
524
read(File) ->
525
525
    read(File, []).
526
526
 
527
 
%% @spec read(File::filename(), Options::option_list()) -> string()
 
527
%% @spec read(File::filename(), Options::proplist()) -> string()
528
528
%%
529
529
%% @doc Reads and processes a source file and returns the resulting
530
530
%% EDoc-text as a string. See {@link get_doc/2} and {@link layout/2} for
545
545
layout(Doc) ->
546
546
    layout(Doc, []).
547
547
 
548
 
%% @spec layout(Doc::edoc_module(), Options::option_list()) -> string()
 
548
%% @spec layout(Doc::edoc_module(), Options::proplist()) -> string()
549
549
%%
550
550
%% @doc Transforms EDoc module documentation data to text. The default
551
551
%% layout creates an HTML document.
562
562
%% </dl>
563
563
%%
564
564
%% @see layout/1
 
565
%% @see run/3
565
566
%% @see read/2
566
567
%% @see file/2
567
568
 
580
581
read_comments(File) ->
581
582
    read_comments(File, []).
582
583
 
583
 
%% @spec read_comments(File::filename(), Options::option_list()) ->
 
584
%% @spec read_comments(File::filename(), Options::proplist()) ->
584
585
%%           [comment()]
585
 
%%
586
 
%%   comment() = {Line, Column, Indentation, Text}
587
 
%%   Line = integer()
588
 
%%   Column = integer()
589
 
%%   Indentation = integer()
 
586
%% where
 
587
%%   comment() = {Line, Column, Indentation, Text},
 
588
%%   Line = integer(),
 
589
%%   Column = integer(),
 
590
%%   Indentation = integer(),
590
591
%%   Text = [string()]
591
592
%%
592
593
%% @doc Extracts comments from an Erlang source code file. See the
603
604
read_source(Name) ->
604
605
    read_source(Name, []).
605
606
 
606
 
%% @spec read_source(File::filename(), Options::option_list()) ->
 
607
%% @spec read_source(File::filename(), Options::proplist()) ->
607
608
%%           [syntaxTree()]
608
609
%%
609
610
%% @type syntaxTree() = //syntax_tools/erl_syntax:syntaxTree()
628
629
%%  <dt>{@type {includes, Path::[string()]@}}
629
630
%%  </dt>
630
631
%%  <dd>Specifies a list of directory names to be searched for include
631
 
%%      files, if the `preprocess' option is turned on. The default
632
 
%%      value is the empty list. The directory of the source file is
633
 
%%      always automatically appended to the search path.
 
632
%%      files, if the `preprocess' option is turned on. Also used with
 
633
%%      the `@headerfile' tag. The default value is the empty list. The
 
634
%%      directory of the source file is always automatically appended to
 
635
%%      the search path.
634
636
%%  </dd>
635
637
%%  <dt>{@type {macros, [{atom(), term()@}]@}}
636
638
%%  </dt>
696
698
get_doc(File) ->
697
699
    get_doc(File, []).
698
700
 
699
 
%% @spec get_doc(File::filename(), Options::option_list()) ->
 
701
%% @spec get_doc(File::filename(), Options::proplist()) ->
700
702
%%           {ModuleName, edoc_module()}
701
703
%%      ModuleName = atom()
702
704
%%
717
719
%%       <li>`Macro' = {@type {Name::atom(), Text::string()@}}</li>
718
720
%%      </ul>
719
721
%%    Specifies a set of EDoc macro definitions. See
720
 
%%    <a href="overview-summary.html#macros">Inline macro expansion</a>
 
722
%%    <a href="overview-summary.html#Macro_expansion">Inline macro expansion</a>
721
723
%%    for details.
722
724
%%  </dd>
723
725
%%  <dt>{@type {hidden, bool()@}}
742
744
%% edoc_lib:get_doc_env/4} for further options.
743
745
%%
744
746
%% @see get_doc/3
 
747
%% @see run/3
745
748
%% @see edoc_extract:source/5
746
749
%% @see read/2
747
750
%% @see layout/2
754
757
    get_doc(File, Env, Opts).
755
758
 
756
759
%% @spec get_doc(File::filename(), Env::edoc_lib:edoc_env(),
757
 
%%        Options::option_list()) -> {ModuleName, edoc_module()}
 
760
%%        Options::proplist()) -> {ModuleName, edoc_module()}
758
761
%%     ModuleName = atom()
759
762
%%
760
763
%% @doc Like {@link get_doc/2}, but for a given environment