File: api_generation.inc

package info (click to toggle)
critcl 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 9,680 kB
  • sloc: ansic: 41,058; tcl: 12,090; sh: 7,230; pascal: 3,456; asm: 3,058; ada: 1,681; cpp: 1,001; cs: 879; makefile: 333; perl: 104; xml: 95; f90: 10
file content (37 lines) | stat: -rw-r--r-- 1,491 bytes parent folder | download | duplicates (3)
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

While file generation is related to the diversions explained in the
previous section they are not the same.

Even so, like diversions this feature is for higher-level packages
generating their own C code.

[para] Three examples of utility packages using this facility comes
with critcl itself.

See the implementations of packages [package critcl::literals],
[package critcl::bitmap], and [package critcl::enum].

[para] When splitting a package implementation into pieces it is often
sensible to have a number of pure C companion files containing
low-level code, yet these files may require information about the code
in the main [file .critcl] file. Such declarations are normally not
exportable and using the stub table support does not make sense, as
this is completely internal to the package.

[para] With the file generation command below the main [file .critcl]
file can generate any number of header files for the C companions to
pick up.

[list_begin definitions]
[comment {- - -- --- ----- -------- ------------- ---------------------}]
[call [cmd ::critcl::make] [arg path] [arg contents]]

This command creates the file [arg path] in a location where the C
companion files of the package are able to pick it up by simple
inclusion of [arg path] during their compilation, without interfering
with the outer system at all.

[para] The generated file will contain the specified [arg contents].

[comment {- - -- --- ----- -------- ------------- ---------------------}]
[list_end]