[ef726a2] | 1 | %{ |
---|
| 2 | /* |
---|
[deafd6] | 3 | * $Id: demo.mod,v 1.2 2002-07-03 12:52:25 anne Exp $ |
---|
[ef726a2] | 4 | * |
---|
| 5 | * Test mod fuer modgen |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #include <stdio.h> |
---|
| 9 | |
---|
| 10 | extern void piShowProcList(); |
---|
| 11 | %} |
---|
| 12 | |
---|
| 13 | // some comments here |
---|
| 14 | |
---|
[deafd6] | 15 | category="tests"; |
---|
[ef726a2] | 16 | package="demo_module"; |
---|
[deafd6] | 17 | version = "$Id: demo.mod,v 1.2 2002-07-03 12:52:25 anne Exp $"; |
---|
[ef726a2] | 18 | info =" |
---|
| 19 | LIBRARY: 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 | %% |
---|
[deafd6] | 36 | %Singular |
---|
| 37 | |
---|
| 38 | proc testa (int i,int j) |
---|
| 39 | " keine Hilfe" |
---|
| 40 | { |
---|
| 41 | "testa"; |
---|
| 42 | int a=i-j; |
---|
| 43 | return(a); |
---|
| 44 | } |
---|
| 45 | example |
---|
| 46 | { |
---|
| 47 | testa(2,3); |
---|
| 48 | } |
---|
[ef726a2] | 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 | */ |
---|
| 55 | none proclist |
---|
| 56 | { |
---|
| 57 | piShowProcList(); |
---|
| 58 | %return(); |
---|
| 59 | } |
---|
| 60 | example |
---|
| 61 | { |
---|
| 62 | proclist(); |
---|
| 63 | } |
---|
| 64 | |
---|
| 65 | /* |
---|
| 66 | * |
---|
| 67 | * diese procedur ist mit Absicht auskommentart - ich weiss nicht, |
---|
| 68 | * wie sie richtig gehen soll/ |
---|
| 69 | static start_sg |
---|
| 70 | { |
---|
| 71 | %singularcmd(inout::f(q,w,e)); |
---|
| 72 | } |
---|
| 73 | |
---|
| 74 | /* |
---|
| 75 | */ |
---|
| 76 | int 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 | } |
---|
| 92 | example |
---|
| 93 | { Demo::mysum(2,3); |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | ideal 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 | |
---|
| 114 | ideal toid2(ideal) { |
---|
| 115 | // generate internal variable declaration |
---|
| 116 | // |
---|
| 117 | %declaration; |
---|
| 118 | |
---|
| 119 | return FALSE; |
---|
| 120 | // %return(); |
---|
| 121 | }; |
---|
| 122 | |
---|
| 123 | /* / typedef, |
---|
| 124 | k_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 | |
---|
| 154 | into { |
---|
| 155 | } |
---|
| 156 | */ |
---|
| 157 | /* |
---|
| 158 | string nn(string) { |
---|
| 159 | function=iiKernelMiscNN; |
---|
| 160 | }; |
---|
| 161 | */ |
---|
| 162 | |
---|
| 163 | %% |
---|
| 164 | %C |
---|
| 165 | |
---|
| 166 | /*proc sscanf(string, string) = IOsscanf; */ |
---|
| 167 | |
---|
| 168 | void mytest() |
---|
| 169 | { |
---|
| 170 | printf("Test\n"); |
---|
| 171 | printf("here commes some other C-text\n"); |
---|
| 172 | } |
---|