"Fossies" - the Fresh Open Source Software Archive 
Member "ncc-2.8/doc/farg.c" (17 May 2003, 843 Bytes) of package /linux/privat/old/ncc-2.8.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style:
standard) with prefixed line numbers and
code folding option.
Alternatively you can here
view or
download the uninterpreted source code file.
1 /*
2 run ncc on this file, with : ncc farg.c
3
4 to see how pointer-to-function function arguments are reported.
5
6 The new thing is the new output directive 'R'
7
8 R: A B
9
10 Should be interpreted by nccnav that the callers of 'A' do not
11 really call 'A' but 'B'. This is a "replacement" directive.
12
13 */
14
15 int f1(){}
16 int f2(){}
17 int f3(){}
18 int f4(){}
19
20 struct CALLBACK {
21 int (*fp) ();
22 } OBJ;
23
24 int test ()
25 {
26 OBJ.fp ();
27 }
28
29 int foo (int (*f)())
30 {
31 f ();
32 }
33
34 int bar (int (*a)(), int (*b)())
35 {
36 OBJ.fp = a;
37 foo (a);
38 b ();
39 }
40
41 int main ()
42 {
43 bar (f1, f2);
44 bar (f3, f2);
45 bar (f4, 0);
46 // this is not implemented
47 //bar (OBJ.fp, 0);
48 }
49
50 //
51 // sample qsort
52 //
53
54 int strcmp (char*, char*);
55
56 int qsort (void *v, int n, int (*comp)(void*, void*))
57 {
58 qsort (v/2, n/2, comp);
59 comp (v[0], v [1]);
60 }
61
62 void do_sort ()
63 {
64 char v [100];
65 qsort (v, 100, strcmp);
66 }