source: project/wiki/Declarations @ 4006

Last change on this file since 4006 was 4006, checked in by svnwiki, 13 years ago

Changes applied for Gelisam (74.57.214.183) through svnwiki:

removed a spurious (and probably automatically generateed) [declaration specifier]

File size: 8.9 KB
Line 
1[[tags: manual]]
2[[toc:]]
3
4
5== Declarations
6
7
8=== declare
9
10 [syntax] (declare DECLSPEC ...)
11
12Process declaration specifiers. Declarations always override
13any command-line settings.  Declarations are valid for the whole
14compilation-unit (source file), the position of the declaration in
15the source file can be arbitrary. Declarations are ignored in the interpreter
16but not in code evaluated at compile-time (by {{eval-when}} or in
17syntax extensions loaded via {{require-extension}} or {{require-for-syntax}}.
18{{DECLSPEC}} may be any of the following:
19
20
21=== always-bound
22
23 [declaration specifier] (always-bound SYMBOL ...)
24
25Declares that the given variables are always bound and
26accesses to those have not to be checked.
27
28
29=== block
30
31 [declaration specifier] (block)
32
33Assume global variables are never redefined. This is the same as
34specifying the {{-block}} option.
35
36
37=== block-global
38=== hide
39
40 [declaration specifier] (block-global SYMBOL ...)
41 [declaration specifier] (hide SYMBOL ...)
42
43Declares that the toplevel bindings for {{SYMBOL ...}}
44should not be accessible from code in other compilation units or by
45{{eval}}. Access to toplevel bindings declared as block global is
46also more efficient.
47
48
49=== bound-to-procedure
50
51 [declaration specifier] (bound-to-procedure SYMBOL ...)
52
53Declares that the given identifiers are always bound to procedure values.
54
55
56=== c-options
57
58 [declaration specifier] (c-options STRING ...)
59
60Declares additional C/C++ compiler options that are to be passed to the subsequent compilation pass
61that translates C to machine code. This declaration will only work if the source file is compiled
62with the {{csc}} compiler driver.
63
64
65=== check-c-syntax
66
67 [declaration specifier] (check-c-syntax)
68 [declaration specifier] (not check-c-syntax)
69
70Enables or disables syntax-checking of embedded C/C++ code fragments. Checking C syntax is the default.
71
72
73=== compress-literals
74
75 [declaration specifier] (compress-literals [THRESHOLD [INITIALIZER]])
76
77The same as the {{-compress-literals}} compiler option.
78The threshold argument defaults to 50. If the optional argument {{INITIALIZER}}
79is given, then the literals will not be created at module startup,
80but when the procedure with this name will be called.
81
82=== constant
83
84 [declaration specifier] (constant SYMBOL ...)
85
86Declares the procedures with the names {{SYMBOL ...}} as constant, that is, as not having any
87side effects. This can help the compiler to remove non-side-effecting expressions.
88
89
90=== export
91
92 [declaration specifier] (export SYMBOL ...)
93
94The opposite of {{hide}}. All given identifiers will be exported and all toplevel variables
95not listed will be hidden and not be accessible outside of this compilation unit.
96
97
98=== emit-exports
99
100 [declaration specifier] (emit-exports STRING)
101
102Write exported toplevel variables to file with name {{STRING}}.
103
104
105=== emit-external-prototypes-first
106
107 [declaration specifier] (emit-external-prototypes-first)
108
109Emit prototypes for callbacks defined with {{define-external}} before any
110other foreign declarations. Equivalent to giving the {{-emit-external-prototypes-first}}
111option to the compiler.
112
113
114=== disable-interrupts
115
116 [declaration specifier] (disable-interrupts)
117 [declaration specifier] (not interrupts-enabled)
118
119Disable timer-interrupts checks in the compiled program. Threads can
120not be preempted in main- or library-units that contain this declaration.
121
122
123=== disable-warning
124
125 [declaration specifier] (disable-warning CLASS ...)
126
127Disable warnings of type {{CLASS ...}} (equivalent to the {{-disable-warning CLASS}}
128compiler option).
129
130
131=== import
132
133 [declaration specifier] (import SYMBOL-OR-STRING ...)
134
135Adds new imports to the list of externally available toplevel variables. Arguments to this declaration
136may be either strings (designating {{.exports}} files, without the file-extension) or symbols
137which directly designate imported variables.
138
139
140=== inline
141
142 [declaration specifier] (inline)
143 [declaration specifier] (not inline)
144 [declaration specifier] (inline IDENTIFIER ...)
145 [declaration specifier] (not inline IDENTIFIER ...)
146
147If given without an identifier-list, inlining of known procedures is enabled (this is equivalent to the {{-inline}}
148compiler option). When an identifier-list is given, then inlining is enabled only for the specified global procedures.
149The negated forms {{(not inline)}} and {{(not inline IDENTIFIER)}} disable global inlining, or inlining for
150the given global procedures only, respectively.
151
152
153=== inline-limit
154
155 [declaration specifier] (inline-limit THRESHOLD)
156
157Sets the maximum size of procedures which may potentially be inlined. The default threshold is {{10}}.
158
159
160=== interrupts-enabled
161
162 [declaration specifier] (interrupts-enabled)
163
164Enable timer-interrupts checks in the compiled program (the default).
165
166
167=== keep-shadowed-macros
168
169 [declaration specifier] (keep-shadowed-macros)
170
171Normally, when a toplevel variable is assigned or defined that has the same name as a macro, the macro-definition
172will be removed (in addition to showing a warning). This declaration will disable the removal of the macro.
173
174
175=== lambda-lift
176
177 [declaration specifier] (lambda-lift)
178
179Enables lambda-lifting (equivalent to the {{-lambda-lift}} option).
180
181
182=== link-options
183
184 [declaration specifier] (link-options STRING ...)
185
186Declares additional linker compiler options that are to be passed to the subsequent compilation pass
187that links the generated code into an executable or library.
188This declaration will only work if the source file is compiled
189with the {{csc}} compiler driver.
190
191
192=== no-argc-checks
193
194 [declaration specifier] (no-argc-checks)
195
196Disables argument count checking.
197
198
199=== no-bound-checks
200
201 [declaration specifier] (no-bound-checks)
202
203Disables the bound-checking of toplevel bindings.
204
205
206=== no-procedure-checks
207
208 [declaration specifier] (no-procedure-checks)
209
210Disables checking of values in operator position for being of procedure type.
211
212
213=== post-process
214
215 [declaration specifier] (post-process STRING ...)
216
217Arranges for the shell commands {{STRING ...}} to be invoked after the current
218file has been translated to C. Any occurrences of the substring {{$@@}} in the
219strings given for this declaration will be replaced by the pathname of the currently
220compiled file, without the file-extension.
221This declaration will only work if the source file is compiled
222with the {{csc}} compiler driver.
223
224
225=== number-type
226=== fixnum-arithmetic
227
228 [declaration specifier] ([number-type] TYPE)
229 [declaration specifier] (fixnum-arithmetic)
230
231Declares that only numbers of the given type are used. {{TYPE}}
232may be {{fixnum}} or {{generic}} (which is
233the default).
234
235
236=== run-time-macros
237
238 [declaration specifier] (run-time-macros)
239
240Equivalent to the compiler option of the same name - macros defined in the compiled code are also made available at
241runtime.
242
243
244=== standard-bindings
245
246 [declaration specifier] (standard-bindings SYMBOL ...)
247 [declaration specifier] (not standard-bindings SYMBOL ...)
248
249Declares that all given standard procedures (or all if no symbols are
250specified) are never globally redefined.  If {{not}} is specified,
251then all but the given standard bindings are assumed to be never
252redefined.
253
254
255=== extended-bindings
256
257 [declaration specifier] (extended-bindings SYMBOL ...)
258 [declaration specifier] (not extended-bindings SYMBOL ...)
259
260Declares that all given non-standard and CHICKEN-specific procedures (or all if no symbols are specified) are never globally redefined.
261If {{not}} is specified, then all but the given extended bindings
262are assumed to be never redefined.
263
264
265=== usual-integrations
266
267 [declaration specifier] (usual-integrations SYMBOL ...)
268 [declaration specifier] (not usual-integrations SYMBOL ...)
269
270Declares that all given standard and extended bindings (or all if no
271symbols are specified) are never globally redefined.  If {{not}}
272is specified, then all but the given standard and extended bindings are
273assumed to be never redefined. Note that this is the default behaviour,
274unless the {{-no-usual-integrations}} option has been given.
275
276
277=== unit
278
279 [declaration specifier] (unit SYMBOL)
280
281Specify compilation unit-name (if this is a library)
282
283
284=== unsafe
285
286 [declaration specifier] (unsafe)
287 [declaration specifier] (not safe)
288
289Do not generate safety-checks. This is the same as specifying the
290{{-unsafe}} option.  Also implies
291
292
293 (declare (no-bound-checks) (no-procedure-checks) (no-argc-checks))
294
295
296=== unused
297
298 [declaration specifier] (unused SYMBOL ...)
299
300Disables any warnings when the global variable {{SYMBOL}} is not defined but used,
301or defined but never used and not exported.
302
303
304=== uses
305
306 [declaration specifier] (uses SYMBOL ...)
307
308Gives a list of used library-units. Before the toplevel-expressions
309of the main-module are executed, all used units evaluate their
310toplevel-expressions in the order in which they appear in this
311declaration. If a library unit A uses another unit B, then B's toplevel
312expressions are evaluated before A's.  Furthermore, the used symbols
313are registered as features during compile-time, so {{cond-expand}}
314knows about them.
315
316Previous: [[Pattern matching]]
317
318Next: [[Parameters]]
Note: See TracBrowser for help on using the repository browser.