source: git/modules/demo.mod @ 2d19f3a

spielwiese
Last change on this file since 2d19f3a was deafd6, checked in by Anne Frühbis-Krüger <anne@…>, 22 years ago
*anne: added %Singular part to demo.mod for testing git-svn-id: file:///usr/local/Singular/svn/trunk@6186 2c84dea3-7e68-4137-9b89-c4e89433aadc
  • Property mode set to 100644
File size: 2.3 KB
Line 
1%{
2/*
3 *  $Id: demo.mod,v 1.2 2002-07-03 12:52:25 anne Exp $
4 *
5 *  Test mod fuer modgen
6 */
7
8#include <stdio.h>
9
10extern void piShowProcList();
11%}
12
13// some comments here
14
15category="tests";
16package="demo_module";
17version = "$Id: demo.mod,v 1.2 2002-07-03 12:52:25 anne Exp $";
18info    ="
19LIBRARY: kernel.lib  PROCEDURES OF GENERAL TYPE WRITEN IN C
20
21  proclist();    Lists all procedures.
22";
23
24//%{
25//static int i;
26//%}
27
28//other ="hallo";   // should return an error
29
30//cxxsource = proclist.cc , misc.cc;
31//cxxsource = misc.cc;
32/*cxxsource = sscanf.cc
33*/
34
35%%
36%Singular
37
38proc testa (int i,int j)
39" keine Hilfe"
40{
41  "testa";
42  int a=i-j;
43  return(a);
44}
45example
46{
47  testa(2,3);
48}
49%procedures
50/*
51 * NAME:     proclist
52 *           procedure without any parameter and no return value;
53 * PURPOSE:  shows a list of all defined procedure.
54 */
55none proclist
56{
57  piShowProcList();
58  %return();
59}
60example
61{
62  proclist();
63}
64
65/*
66 *
67 * diese procedur ist mit Absicht auskommentart - ich weiss nicht,
68 * wie sie richtig gehen soll/
69static start_sg
70{
71  %singularcmd(inout::f(q,w,e));
72}
73
74/*
75 */
76int mysum(
77        int i,
78        int j
79        )
80"Return sum of i and j"
81{
82  // generate internal variable declaration
83  //
84  %declaration;
85
86  // generate typecheck and typeconversation code
87  %typecheck;
88 
89  //%return = (void*)((int)i->Data() + (int)j->Data());
90  %return = (void *)(i + j);
91}
92example
93{ Demo::mysum(2,3);
94}
95
96ideal toid()
97// call function toid();
98{
99  // generate internal variable declaration
100  // (will write nothing: there are no parameters
101  %declaration;
102
103  // generate typecheck and typeconversation code
104  // (will write nothing: there are no parameters)
105  %typecheck;
106
107  // generate return vector
108  // data=toid();
109  //%return(my_toid);
110  return FALSE;
111
112};
113
114ideal toid2(ideal) {
115  // generate internal variable declaration
116  //
117  %declaration;
118
119  return FALSE;
120//  %return();
121};
122
123/* /    typedef,
124k_test(
125        ideal,
126        int,
127        intvec,
128        intmat,
129        link,
130        list,
131        map,
132        matrix,
133        module,
134        number,
135        package,
136        poly,
137        proc,
138        qring,
139        ring,
140        string,
141        vector
142)
143//function="k_test_func";
144{
145  %declaration;
146 
147  printf("Nur ein Test\n");
148
149  %typecheck;
150  %return;
151 
152}
153
154into {
155}
156*/
157/*
158string nn(string) {
159  function=iiKernelMiscNN;
160};
161*/
162
163%%
164%C
165
166/*proc sscanf(string, string) = IOsscanf; */
167
168void mytest()
169{
170  printf("Test\n");
171  printf("here commes some other C-text\n");
172}
Note: See TracBrowser for help on using the repository browser.