File: inline-doc.ck

package info (click to toggle)
chuck 1.5.5.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 41,056 kB
  • sloc: cpp: 123,473; ansic: 35,893; javascript: 2,111; yacc: 609; makefile: 457; python: 174; perl: 86
file content (58 lines) | stat: -rw-r--r-- 1,835 bytes parent folder | download | duplicates (2)
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
// show how to add descriptions with classes and functions
// using @doc; descriptions added in this manner are associatd
// with respective classes and functions and will appear in the
// .help() runtime info mechanism, as well as in documentation
// generated using CKDoc.
//
// requires: chuck-1.5.4.5 or higher

// add inline documenation (processed at compile-time)
// (@doc must appear right before the class definition)
@doc "this is a description for the class Foo"
class Foo
{
    // add inline documenation (processed at compile-time)
    // (@doc must appear immediately before the function definition)
    @doc "a function in Foo, bar() likes calling his friends"
    fun void bar()
    {
        beth();
        kenny();
    }

    // add inline documenation (processed at compile-time)
    @doc "beth() is working on a novel about shared memory"
    fun static void beth()
    { }

    // add inline documenation (processed at compile-time)
    @doc "kenny() is fun, and expects nothing in return"
    fun static void kenny()
    { }

    // add inline documentation for variable
    @doc "this here is a variable called varFoo"
    5 => int varFoo;

    // add inline documentation for variable
    @doc "this here is a static variable called varBar"
    10 => static int varBar;

    // add inline documentation for variable (but hide it)
    @doc "(hidden) this variable is documented but hidden from ckdoc"
    15 => static int varBarHidden;
}

// print runtime info about Foo...
// (will also appear in documentation generated by CKDoc)
<<< CKDoc.describe( Foo ) >>>;
<<< CKDoc.describe( Foo.beth ) >>>;
<<< CKDoc.describe( Foo.kenny ) >>>;

// with an instance, can also get info about instanced functions
Foo f;
<<< CKDoc.describe( f ) >>>;
<<< CKDoc.describe( f.bar ) >>>;

// print the ckdoc for Foo
Foo.help();