aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/doc/src/c.xml
blob: e5238fa7dbc42773bbb4c40856a6fbec06122d0c (plain) (blame)
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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>
  <header>
    <copyright>
      <year>1996</year><year>2013</year>
      <holder>Ericsson AB. All Rights Reserved.</holder>
    </copyright>
    <legalnotice>
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
 
          http://www.apache.org/licenses/LICENSE-2.0

      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      See the License for the specific language governing permissions and
      limitations under the License.
    
    </legalnotice>

    <title>c</title>
    <prepared>Joe Armstrong</prepared>
    <docno>1</docno>
    <date>96-10-30</date>
    <rev>B</rev>
  </header>
  <module>c</module>
  <modulesummary>Command Interface Module</modulesummary>
  <description>
    <p>The <c>c</c> module enables users to enter the short form of
      some commonly used commands.</p>
    <note>
      <p>These functions are are intended for interactive use in
        the Erlang shell only. The module prefix may be omitted.</p>
    </note>
  </description>
  <funcs>
    <func>
      <name name="bt" arity="1"/>
      <fsummary>Stack backtrace for a process</fsummary>
      <desc>
        <p>Stack backtrace for a process. Equivalent to
          <c>erlang:process_display(<anno>Pid</anno>, backtrace)</c>.</p>
      </desc>
    </func>
    <func>
      <name name="c" arity="1"/>
      <name name="c" arity="2"/>
      <fsummary>Compile and load code in a file</fsummary>
      <desc>
        <p><c>c/1,2</c> compiles and then purges and loads the code for
          a file. <c><anno>Options</anno></c> defaults to []. Compilation is
          equivalent to:</p>
        <code type="none">
compile:file(<anno>File</anno>, <anno>Options</anno> ++ [report_errors, report_warnings])</code>
        <p>Note that purging the code means that any processes
          lingering in old code for the module are killed without
          warning. See <c>code/3</c> for more information.</p>
      </desc>
    </func>
    <func>
      <name name="cd" arity="1"/>
      <fsummary>Change working directory</fsummary>
      <desc>
        <p>Changes working directory to <c><anno>Dir</anno></c>, which may be a
          relative name, and then prints the name of the new working
          directory.</p>
        <pre>
2> <input>cd("../erlang").</input>
/home/ron/erlang</pre>
      </desc>
    </func>
    <func>
      <name name="flush" arity="0"/>
      <fsummary>Flush any messages sent to the shell</fsummary>
      <desc>
        <p>Flushes any messages sent to the shell.</p>
      </desc>
    </func>
    <func>
      <name name="help" arity="0"/>
      <fsummary>Help information</fsummary>
      <desc>
        <p>Displays help information: all valid shell internal commands,
          and commands in this module.</p>
      </desc>
    </func>
    <func>
      <name name="i" arity="0"/>
      <name name="ni" arity="0"/>
      <fsummary>Information about the system</fsummary>
      <desc>
        <p><c>i/0</c> displays information about the system, listing
          information about all processes. <c>ni/0</c> does the same,
          but for all nodes the network.</p>
      </desc>
    </func>
    <func>
      <name name="i" arity="3"/>
      <fsummary>Information about pid &lt;X.Y.Z&gt;</fsummary>
      <desc>
        <p>Displays information about a process, Equivalent to
          <c>process_info(pid(<anno>X</anno>, <anno>Y</anno>, <anno>Z</anno>))</c>, but location transparent.</p>
      </desc>
    </func>
    <func>
      <name name="l" arity="1"/>
      <fsummary>Load or reload module</fsummary>
      <desc>
        <p>Purges and loads, or reloads, a module by calling
          <c>code:purge(<anno>Module</anno>)</c> followed by
          <c>code:load_file(<anno>Module</anno>)</c>.</p>
        <p>Note that purging the code means that any processes
          lingering in old code for the module are killed without
          warning. See <c>code/3</c> for more information.</p>
      </desc>
    </func>
    <func>
      <name>lc(Files) -> ok</name>
      <fsummary>Compile a list of files</fsummary>
      <type>
        <v>Files = [File]</v>
        <v>File = <seealso marker="file#type-filename">file:filename()
          </seealso></v>
      </type>
      <desc>
        <p>Compiles a list of files by calling <c>compile:file(File, [report_errors, report_warnings])</c> for each <c>File</c>
          in <c>Files</c>.</p>
      </desc>
    </func>
    <func>
      <name name="ls" arity="0"/>
      <fsummary>List files in the current directory</fsummary>
      <desc>
        <p>Lists files in the current directory.</p>
      </desc>
    </func>
    <func>
      <name name="ls" arity="1"/>
      <fsummary>List files in a directory or a single file</fsummary>
      <desc>
        <p>Lists files in directory <c><anno>Dir</anno></c> or, if Dir is a file, only list it.</p>
      </desc>
    </func>
    <func>
      <name name="m" arity="0"/>
      <fsummary>Which modules are loaded</fsummary>
      <desc>
        <p>Displays information about the loaded modules, including
          the files from which they have been loaded.</p>
      </desc>
    </func>
    <func>
      <name name="m" arity="1"/>
      <fsummary>Information about a module</fsummary>
      <desc>
        <p>Displays information about <c><anno>Module</anno></c>.</p>
      </desc>
    </func>
    <func>
      <name name="memory" arity="0"/>
      <fsummary>Memory allocation information</fsummary>
      <desc>
        <p>Memory allocation information. Equivalent to
          <seealso marker="erts:erlang#memory/0"><c>erlang:memory/0</c>
          </seealso>.</p>
      </desc>
    </func>
    <func>
      <name name="memory" arity="1" clause_i="1"/>
      <name name="memory" arity="1" clause_i="2"/>
      <fsummary>Memory allocation information</fsummary>
      <desc>
        <p>Memory allocation information. Equivalent to
          <seealso marker="erts:erlang#memory/1"><c>erlang:memory/1</c>
          </seealso>.</p>
      </desc>
    </func>
    <func>
      <name name="nc" arity="1"/>
      <name name="nc" arity="2"/>
      <fsummary>Compile and load code in a file on all nodes</fsummary>
      <desc>
        <p>Compiles and then loads the code for a file on all nodes.
          <c><anno>Options</anno></c> defaults to []. Compilation is equivalent to:</p>
        <code type="none">
compile:file(<anno>File</anno>, <anno>Options</anno> ++ [report_errors, report_warnings])</code>
      </desc>
    </func>
    <func>
      <name name="nl" arity="1"/>
      <fsummary>Load module on all nodes</fsummary>
      <desc>
        <p>Loads <c><anno>Module</anno></c> on all nodes.</p>
      </desc>
    </func>
    <func>
      <name name="pid" arity="3"/>
      <fsummary>Convert X,Y,Z to a pid</fsummary>
      <desc>
        <p>Converts <c><anno>X</anno></c>, <c><anno>Y</anno></c>, <c><anno>Z</anno></c> to the pid
          <c><![CDATA[<X.Y.Z>]]></c>. This function should only be used when
          debugging.</p>
      </desc>
    </func>
    <func>
      <name name="pwd" arity="0"/>
      <fsummary>Print working directory</fsummary>
      <desc>
        <p>Prints the name of the working directory.</p>
      </desc>
    </func>
    <func>
      <name name="q" arity="0"/>
      <fsummary>Quit - shorthand for <c>init:stop()</c></fsummary>
      <desc>
        <p>This function is shorthand for <c>init:stop()</c>, that is,
          it causes the node to stop in a controlled fashion.</p>
      </desc>
    </func>
    <func>
      <name name="regs" arity="0"/>
      <name name="nregs" arity="0"/>
      <fsummary>Information about registered processes</fsummary>
      <desc>
        <p><c>regs/0</c> displays information about all registered
          processes. <c>nregs/0</c> does the same, but for all nodes
          in the network.</p>
      </desc>
    </func>
    <func>
      <name name="uptime" arity="0"/>
      <fsummary>Print node uptime</fsummary>
      <desc>
        <p>Prints the node uptime (as given by
           <c>erlang:statistics(wall_clock)</c>), in human-readable form.</p>
      </desc>
    </func>
    <func>
      <name>xm(ModSpec) -> void()</name>
      <fsummary>Cross reference check a module</fsummary>
      <type>
        <v>ModSpec = Module | Filename</v>
        <v>&nbsp;Module = atom()</v>
        <v>&nbsp;Filename = string()</v>
      </type>
      <desc>
        <p>This function finds undefined functions, unused functions,
          and calls to deprecated functions in a module by calling
          <c>xref:m/1</c>.</p>
      </desc>
    </func>
    <func>
      <name>y(File) -> YeccRet</name>
      <fsummary>Generate an LALR-1 parser</fsummary>
      <type>
        <v>File = name() -- see filename(3)</v>
        <v>YeccRet = -- see yecc:file/2</v>
      </type>
      <desc>
        <p>Generates an LALR-1 parser. Equivalent to:</p>
        <code type="none">
yecc:file(File)</code>
      </desc>
    </func>
    <func>
      <name>y(File, Options) -> YeccRet</name>
      <fsummary>Generate an LALR-1 parser</fsummary>
      <type>
        <v>File = name() -- see filename(3)</v>
        <v>Options, YeccRet = -- see yecc:file/2</v>
      </type>
      <desc>
        <p>Generates an LALR-1 parser. Equivalent to:</p>
        <code type="none">
yecc:file(File, Options)</code>
      </desc>
    </func>
  </funcs>

  <section>
    <title>See Also</title>
    <p><seealso marker="compiler:compile">compile(3)</seealso>,
      <seealso marker="filename">filename(3)</seealso>, 
      <seealso marker="erts:erlang">erlang(3)</seealso>, 
      <seealso marker="parsetools:yecc">yecc(3)</seealso>,
      <seealso marker="tools:xref">xref(3)</seealso></p>
  </section>
</erlref>