1 | %{ |
---|
2 | /* |
---|
3 | * $Id: demo.mod,v 1.1 2002-06-25 08:20:49 anne Exp $ |
---|
4 | * |
---|
5 | * Test mod fuer modgen |
---|
6 | */ |
---|
7 | |
---|
8 | #include <stdio.h> |
---|
9 | |
---|
10 | extern void piShowProcList(); |
---|
11 | %} |
---|
12 | |
---|
13 | // some comments here |
---|
14 | |
---|
15 | package="demo_module"; |
---|
16 | version = "$Id: demo.mod,v 1.1 2002-06-25 08:20:49 anne Exp $"; |
---|
17 | info =" |
---|
18 | LIBRARY: kernel.lib PROCEDURES OF GENERAL TYPE WRITEN IN C |
---|
19 | |
---|
20 | proclist(); Lists all procedures. |
---|
21 | "; |
---|
22 | |
---|
23 | //%{ |
---|
24 | //static int i; |
---|
25 | //%} |
---|
26 | |
---|
27 | //other ="hallo"; // should return an error |
---|
28 | |
---|
29 | //cxxsource = proclist.cc , misc.cc; |
---|
30 | //cxxsource = misc.cc; |
---|
31 | /*cxxsource = sscanf.cc |
---|
32 | */ |
---|
33 | |
---|
34 | %% |
---|
35 | %procedures |
---|
36 | /* |
---|
37 | * NAME: proclist |
---|
38 | * procedure without any parameter and no return value; |
---|
39 | * PURPOSE: shows a list of all defined procedure. |
---|
40 | */ |
---|
41 | none proclist |
---|
42 | { |
---|
43 | piShowProcList(); |
---|
44 | %return(); |
---|
45 | } |
---|
46 | example |
---|
47 | { |
---|
48 | proclist(); |
---|
49 | } |
---|
50 | |
---|
51 | /* |
---|
52 | * |
---|
53 | * diese procedur ist mit Absicht auskommentart - ich weiss nicht, |
---|
54 | * wie sie richtig gehen soll/ |
---|
55 | static start_sg |
---|
56 | { |
---|
57 | %singularcmd(inout::f(q,w,e)); |
---|
58 | } |
---|
59 | |
---|
60 | /* |
---|
61 | */ |
---|
62 | int mysum( |
---|
63 | int i, |
---|
64 | int j |
---|
65 | ) |
---|
66 | "Return sum of i and j" |
---|
67 | { |
---|
68 | // generate internal variable declaration |
---|
69 | // |
---|
70 | %declaration; |
---|
71 | |
---|
72 | // generate typecheck and typeconversation code |
---|
73 | %typecheck; |
---|
74 | |
---|
75 | //%return = (void*)((int)i->Data() + (int)j->Data()); |
---|
76 | %return = (void *)(i + j); |
---|
77 | } |
---|
78 | example |
---|
79 | { Demo::mysum(2,3); |
---|
80 | } |
---|
81 | |
---|
82 | ideal toid() |
---|
83 | // call function toid(); |
---|
84 | { |
---|
85 | // generate internal variable declaration |
---|
86 | // (will write nothing: there are no parameters |
---|
87 | %declaration; |
---|
88 | |
---|
89 | // generate typecheck and typeconversation code |
---|
90 | // (will write nothing: there are no parameters) |
---|
91 | %typecheck; |
---|
92 | |
---|
93 | // generate return vector |
---|
94 | // data=toid(); |
---|
95 | //%return(my_toid); |
---|
96 | return FALSE; |
---|
97 | |
---|
98 | }; |
---|
99 | |
---|
100 | ideal toid2(ideal) { |
---|
101 | // generate internal variable declaration |
---|
102 | // |
---|
103 | %declaration; |
---|
104 | |
---|
105 | return FALSE; |
---|
106 | // %return(); |
---|
107 | }; |
---|
108 | |
---|
109 | /* / typedef, |
---|
110 | k_test( |
---|
111 | ideal, |
---|
112 | int, |
---|
113 | intvec, |
---|
114 | intmat, |
---|
115 | link, |
---|
116 | list, |
---|
117 | map, |
---|
118 | matrix, |
---|
119 | module, |
---|
120 | number, |
---|
121 | package, |
---|
122 | poly, |
---|
123 | proc, |
---|
124 | qring, |
---|
125 | ring, |
---|
126 | string, |
---|
127 | vector |
---|
128 | ) |
---|
129 | //function="k_test_func"; |
---|
130 | { |
---|
131 | %declaration; |
---|
132 | |
---|
133 | printf("Nur ein Test\n"); |
---|
134 | |
---|
135 | %typecheck; |
---|
136 | %return; |
---|
137 | |
---|
138 | } |
---|
139 | |
---|
140 | into { |
---|
141 | } |
---|
142 | */ |
---|
143 | /* |
---|
144 | string nn(string) { |
---|
145 | function=iiKernelMiscNN; |
---|
146 | }; |
---|
147 | */ |
---|
148 | |
---|
149 | %% |
---|
150 | %C |
---|
151 | |
---|
152 | /*proc sscanf(string, string) = IOsscanf; */ |
---|
153 | |
---|
154 | void mytest() |
---|
155 | { |
---|
156 | printf("Test\n"); |
---|
157 | printf("here commes some other C-text\n"); |
---|
158 | } |
---|