Ticket #60: mydemo.mod

File mydemo.mod, 3.3 KB (added by Oleksandr , 15 years ago)

my old test/demo module with modgen-bugs: just uncomment corresponding code...

Line 
1/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
2/* %% Header section: %% */
3%{
4
5// Purpose comment:
6/**
7 *
8 * $Id: mydemo.mod, v 1.0 2006/04/06 12:20:00 motsak Exp $
9 *
10 * This is my demo dynamic module for testing purposes
11 *
12 **/
13
14// Includes go here:
15// #include <.h>
16
17
18extern void piShowProcList(); // for proclist
19
20%}
21/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
22/* %% General declaration section: %% */
23
24category = "tst";
25package  = "mydemo";
26version  = "$Id: mydemo.mod, v 1.0 2006/04/06 12:20:00 motsak Exp $";
27info     = "LIBRARY: mydemo.lib Demo module
28
29PROCEDURES:
30  proclist();            Lists all procedures.
31  testa(i,j);            Does something with i and j.
32";
33// Additional files go here:
34// files    = a.cc, b.cc;
35
36
37/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
38/* %% Initialization section: %% */
39
40%modinitial
41  // Initialization procedures...
42  // no commands to be run upon loading the module
43%endinitial
44
45/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
46/* %% Singular procedures section: %% */
47
48%Singular
49
50proc testa (int i,int j)
51" keine Hilfe"
52{
53  "testa";
54  int a=i-j;
55  return(a);
56}
57example
58{
59  Mydemo::testa(2,3);
60}
61
62
63
64/*
65// BUG in modgen generator: "double quotions in help and example strings are not supported!?!????"
66proc DoubleQuotiontsInHelpAndExample()
67" keine \"Hilfe\" :(((( "
68{
69  "helpme";
70  Mydemo::_helpme();
71 
72}
73example
74{
75  "EXAMPLE: "; echo = 2;
76  Mydemo::helpme();
77}
78*/
79
80
81
82/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
83/* %% C/C++ procedures section: %% */
84
85%procedures
86
87// User accessible C/C++ procedures
88
89/*
90 * NAME:     proclist
91 *           procedure without any parameter and no return value;
92 * PURPOSE:  shows a list of all defined procedures.
93 */
94none proclist
95"
96NAME:     void proclist(void);
97PURPOSE:  shows a list of all defined procedures.
98"
99{
100  piShowProcList();
101  %return();
102}
103example
104{
105  Mydemo::proclist();
106}
107
108
109none _helpme
110{
111  %return();
112}
113
114
115/*
116// BUG in modgen scanner: "parameters of type ring are not supported!?!????"
117none testRingParameter(ring r) // this line gives "error: parse error at end of file"
118{
119  %declaration;
120  %typecheck;
121  %return();
122}
123*/
124
125
126// BUG: jump crosses initialization!
127none jumpCrosses(int j)
128{
129  %declaration;
130  %typecheck;
131 
132  int i = 0; // this line was giving "error: jump crosses initialization"
133 
134  %return();
135}
136
137
138
139
140// BUG: how to return a value?!?!
141int returnSomething(int j)
142{
143  %declaration;
144  %typecheck;
145 
146  int i = j; // this line was giving "error: jump crosses initialization"
147 
148//  %return(i); // this line results into: "__res->data = (void *)i(j);" after generation!?!
149  %return();
150}
151
152
153// BUG:
154poly doubleArguments(poly a, poly b)
155{
156  %declaration;
157    poly result = NULL;
158  %typecheck;
159   
160  %return(result);
161}
162
163// NO BUG!!!
164none doubleArguments2(poly a, poly b)
165{
166  %declaration;
167  %typecheck;
168   
169  %return();
170}
171
172int doubleArguments3(poly a, poly b)
173{
174  %declaration;
175  %typecheck;
176   
177  %return(0);
178}
179
180
181
182/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
183/* %% internal C procedures section: %% */
184
185%C
186
187
188/* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
189/* %% The END %% */
190