home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / Programming / sofa / archive / SmallEiffel.lha / SmallEiffel / lib_show / directory / example013.c < prev    next >
C/C++ Source or Header  |  1999-06-05  |  8KB  |  396 lines

  1. /*
  2. -- ANSI C code generated by :
  3. -- SmallEiffel The GNU Eiffel Compiler -- Release (- 0.78Beta#1)--
  4. -- Copyright (C), 1994-98 - LORIA - UHP - CRIN - INRIA - FRANCE --
  5. -- Dominique COLNET and Suzanne COLLIN -    colnet@loria.fr     --
  6. --                  http://SmallEiffel.loria.fr/                --
  7. */
  8. #include "example01.h"
  9.  
  10.  
  11. void gc_align_mark714(fsoc*c,gc714*p){
  12. gc714*b=(void*)(&(c->first_object));
  13. if((c->header.state_type==FSO_STORE_CHUNK)&&(((char*)p)>=((char*)store714)))return;
  14. if(((char*)p)>((char*)(b+(c->count_minus_one))))return;
  15. if(((char*)p)<((char*)b))return;
  16. if(((((char*)p)-((char*)b))%sizeof(*p))==0){
  17. if(p->header.flag==FSOH_UNMARKED){
  18. T714*o=(void*)p;
  19. ((gc714*)o)->header.flag=FSOH_MARKED;
  20. }
  21. }
  22. }
  23. fsoc H714={{FSOC_SIZE,FSO_STORE_CHUNK,
  24. (void(*)(mch*,void*))gc_align_mark714,
  25. (void(*)(mch*))gc_sweep714},NULL,(((FSOC_SIZE-sizeof(fsoc)+sizeof(double))/sizeof(gc714))-1)};
  26.  
  27.  
  28. T714*new714(void){
  29. gc714*n;
  30. if(store_left714>1){
  31. store_left714--;
  32. n=store714++;
  33. }
  34. else if (gc_free714!=NULL){
  35. n=gc_free714;
  36. gc_free714=n->header.next;
  37. }
  38. else if(store_left714==1){
  39. store_left714=0;
  40. store_chunk714->header.state_type=FSO_USED_CHUNK;
  41. n=store714++;
  42. }
  43. else if(fsocfl!=NULL) {
  44. store_chunk714=fsocfl;
  45. fsocfl=fsocfl->next;
  46. *store_chunk714=H714;
  47. store714=(void*)(&(store_chunk714->first_object));
  48. store_left714=H714.count_minus_one;
  49. n=store714++;
  50. }
  51. else if(fsoc_count_ceil>fsoc_count) {
  52. store_chunk714=malloc(FSOC_SIZE);
  53. fsoc_count++;
  54. {mch**p;
  55. if(gcmt_used==gcmt_max){
  56. gcmt_max<<=1;
  57. gcmt=realloc(gcmt,(gcmt_max+1)*sizeof(void*));
  58. }
  59. for(p=gcmt+(gcmt_used++ -1);(p>=gcmt)&&(*p>((mch*)store_chunk714));p--)
  60. *(p+1)=*p;
  61. *(p+1)=(mch*)store_chunk714;
  62. }
  63. *store_chunk714=H714;
  64. store714=(void*)(&(store_chunk714->first_object));
  65. store_left714=H714.count_minus_one;
  66. n=store714++;
  67. }
  68. else{
  69. gc_start();
  70. if(NULL!=gc_free714){
  71. n=gc_free714;
  72. gc_free714=n->header.next;
  73. }
  74. else{
  75. store_chunk714=new_fsoc();
  76. *store_chunk714=H714;
  77. store714=(void*)(&(store_chunk714->first_object));
  78. store_left714=H714.count_minus_one;
  79. n=store714++;
  80. }
  81. }
  82. n->header.flag=FSOH_UNMARKED;
  83. n->object=M714;
  84. return (void*)n;
  85. }
  86.  
  87.  
  88. void gc_sweep528(fsoc*c){
  89. gc528*o1,*o2,*flt,flh;
  90. o1=((void*)(&(c->first_object)));
  91. if(c->header.state_type==FSO_STORE_CHUNK){
  92. for(;o1<store528;o1++){
  93. if((o1->header.flag)==FSOH_MARKED){
  94. o1->header.flag=FSOH_UNMARKED;
  95. }
  96. else{
  97. o1->header.next=gc_free528;
  98. gc_free528=o1;
  99. }
  100. }
  101. }
  102. else{
  103. int dead=1;
  104. flh.header.next=NULL;
  105. flt=&flh;
  106. o2=o1+c->count_minus_one;
  107. for(;o1<=o2;o2--){
  108. if((o2->header.flag)==FSOH_MARKED){
  109. o2->header.flag=FSOH_UNMARKED;
  110. dead=0;}
  111. else{
  112. flt->header.next=o2;
  113. flt=o2;
  114. }
  115. }
  116. if (dead){
  117. c->next=fsocfl;
  118. fsocfl=c;
  119. c->header.state_type=FSO_FREE_CHUNK;
  120. }
  121. else if(flh.header.next!=NULL){
  122. flt->header.next=gc_free528;
  123. gc_free528=flh.header.next;
  124. }
  125. }
  126. }
  127.  
  128.  
  129. void gc_mark528(T528*o){
  130. se_gc_check_id(o,528);
  131. {((gc528*)o)->header.flag=FSOH_MARKED;
  132.  
  133. }}
  134.  
  135.  
  136. void gc_align_mark528(fsoc*c,gc528*p){
  137. gc528*b=(void*)(&(c->first_object));
  138. if((c->header.state_type==FSO_STORE_CHUNK)&&(((char*)p)>=((char*)store528)))return;
  139. if(((char*)p)>((char*)(b+(c->count_minus_one))))return;
  140. if(((char*)p)<((char*)b))return;
  141. if(((((char*)p)-((char*)b))%sizeof(*p))==0){
  142. if(p->header.flag==FSOH_UNMARKED){
  143. T528*o=(void*)p;
  144. ((gc528*)o)->header.flag=FSOH_MARKED;
  145. }
  146. }
  147. }
  148. fsoc H528={{FSOC_SIZE,FSO_STORE_CHUNK,
  149. (void(*)(mch*,void*))gc_align_mark528,
  150. (void(*)(mch*))gc_sweep528},NULL,(((FSOC_SIZE-sizeof(fsoc)+sizeof(double))/sizeof(gc528))-1)};
  151.  
  152.  
  153. T528*new528(void){
  154. gc528*n;
  155. if(store_left528>1){
  156. store_left528--;
  157. n=store528++;
  158. }
  159. else if (gc_free528!=NULL){
  160. n=gc_free528;
  161. gc_free528=n->header.next;
  162. }
  163. else if(store_left528==1){
  164. store_left528=0;
  165. store_chunk528->header.state_type=FSO_USED_CHUNK;
  166. n=store528++;
  167. }
  168. else if(fsocfl!=NULL) {
  169. store_chunk528=fsocfl;
  170. fsocfl=fsocfl->next;
  171. *store_chunk528=H528;
  172. store528=(void*)(&(store_chunk528->first_object));
  173. store_left528=H528.count_minus_one;
  174. n=store528++;
  175. }
  176. else if(fsoc_count_ceil>fsoc_count) {
  177. store_chunk528=malloc(FSOC_SIZE);
  178. fsoc_count++;
  179. {mch**p;
  180. if(gcmt_used==gcmt_max){
  181. gcmt_max<<=1;
  182. gcmt=realloc(gcmt,(gcmt_max+1)*sizeof(void*));
  183. }
  184. for(p=gcmt+(gcmt_used++ -1);(p>=gcmt)&&(*p>((mch*)store_chunk528));p--)
  185. *(p+1)=*p;
  186. *(p+1)=(mch*)store_chunk528;
  187. }
  188. *store_chunk528=H528;
  189. store528=(void*)(&(store_chunk528->first_object));
  190. store_left528=H528.count_minus_one;
  191. n=store528++;
  192. }
  193. else{
  194. gc_start();
  195. if(NULL!=gc_free528){
  196. n=gc_free528;
  197. gc_free528=n->header.next;
  198. }
  199. else{
  200. store_chunk528=new_fsoc();
  201. *store_chunk528=H528;
  202. store528=(void*)(&(store_chunk528->first_object));
  203. store_left528=H528.count_minus_one;
  204. n=store528++;
  205. }
  206. }
  207. n->header.flag=FSOH_UNMARKED;
  208. n->object=M528;
  209. return (void*)n;
  210. }
  211.  
  212.  
  213. void Xgc_mark878(T0*o){
  214. {int i=o->id;
  215. if (i <= 878) {
  216. gc_mark878((T878*)o);
  217. } else {
  218. gc_mark2074((T2074*)o);
  219. }}}
  220.  
  221.  
  222. T6 X98standard_is_equal(se_dump_stack*caller,int l,int c,int f, void *C,T0* a1){
  223. T6 R=0;
  224. se_dump_stack ds=*caller;
  225. {int id=vc(C,l,c,f)->id;
  226. switch(id){
  227. case 7:R=((T6)(r7standard_is_equal(&ds,se_i7(&ds,((T7*)C)),a1)));
  228.  
  229. break;
  230. case 474:R=((T6)(r474standard_is_equal(&ds,((T474*)C),a1)));
  231.  
  232. break;
  233. case 528:R=((T6)(r528standard_is_equal(&ds,((T528*)C),a1)));
  234.  
  235. break;
  236. case 660:R=((T6)(r660standard_is_equal(&ds,((T660*)C),a1)));
  237.  
  238. break;
  239. case 701:R=((T6)(r701standard_is_equal(&ds,((T701*)C),a1)));
  240.  
  241. break;
  242. case 714:R=((T6)(r714standard_is_equal(&ds,((T714*)C),a1)));
  243.  
  244. break;
  245. case 878:R=((T6)(r878standard_is_equal(&ds,((T878*)C),a1)));
  246.  
  247. break;
  248. case 1405:R=((T6)(r1405standard_is_equal(&ds,((T1405*)C),a1)));
  249.  
  250. break;
  251. case 1886:R=((T6)(r1886standard_is_equal(&ds,se_i1886(&ds,((T1886*)C)),a1)));
  252.  
  253. break;
  254. case 2074:R=((T6)(r2074standard_is_equal(&ds,((T2074*)C),a1)));
  255.  
  256. break;
  257. default: error2(C,l,c,f);
  258. }
  259. }
  260. se_dst=caller;
  261. return R;
  262. }
  263.  
  264.  
  265. T6 X98is_equal(se_dump_stack*caller,int l,int c,int f, void *C,T0* a1){
  266. T6 R=0;
  267. se_dump_stack ds=*caller;
  268. {int id=vc(C,l,c,f)->id;
  269. switch(id){
  270. case 7:R=((T6)(r7is_equal(&ds,se_i7(&ds,((T7*)C)),a1)));
  271.  
  272. break;
  273. case 474:R=((T6)(r474is_equal(&ds,((T474*)C),a1)));
  274.  
  275. break;
  276. case 528:R=((T6)(r528is_equal(&ds,((T528*)C),a1)));
  277.  
  278. break;
  279. case 660:R=((T6)(r660is_equal(&ds,((T660*)C),a1)));
  280.  
  281. break;
  282. case 701:R=((T6)(r701is_equal(&ds,((T701*)C),a1)));
  283.  
  284. break;
  285. case 714:R=((T6)(r714is_equal(&ds,((T714*)C),a1)));
  286.  
  287. break;
  288. case 878:R=((T6)(r878is_equal(&ds,((T878*)C),a1)));
  289.  
  290. break;
  291. case 1405:R=((T6)(r1405is_equal(&ds,((T1405*)C),a1)));
  292.  
  293. break;
  294. case 1886:R=((T6)(r1886is_equal(&ds,se_i1886(&ds,((T1886*)C)),a1)));
  295.  
  296. break;
  297. case 2074:R=((T6)(r2074is_equal(&ds,((T2074*)C),a1)));
  298.  
  299. break;
  300. default: error2(C,l,c,f);
  301. }
  302. }
  303. se_dst=caller;
  304. return R;
  305. }
  306.  
  307.  
  308. T6 X878standard_is_equal(se_dump_stack*caller,int l,int c,int f, void *C,T0* a1){
  309. T6 R=0;
  310. se_dump_stack ds=*caller;
  311. {int id=vc(C,l,c,f)->id;
  312. switch(id){
  313. case 878:R=((T6)(r878standard_is_equal(&ds,((T878*)C),a1)));
  314.  
  315. break;
  316. case 2074:R=((T6)(r2074standard_is_equal(&ds,((T2074*)C),a1)));
  317.  
  318. break;
  319. default: error2(C,l,c,f);
  320. }
  321. }
  322. se_dst=caller;
  323. return R;
  324. }
  325.  
  326.  
  327. T6 X878is_equal(se_dump_stack*caller,int l,int c,int f, void *C,T0* a1){
  328. T6 R=0;
  329. se_dump_stack ds=*caller;
  330. {int id=vc(C,l,c,f)->id;
  331. switch(id){
  332. case 878:R=((T6)(r878is_equal(&ds,((T878*)C),a1)));
  333.  
  334. break;
  335. case 2074:R=((T6)(r2074is_equal(&ds,((T2074*)C),a1)));
  336.  
  337. break;
  338. default: error2(C,l,c,f);
  339. }
  340. }
  341. se_dst=caller;
  342. return R;
  343. }
  344.  
  345.  
  346. void X878put_string(se_dump_stack*caller,int l,int c,int f, void *C,T0* a1){
  347. se_dump_stack ds=*caller;
  348. {int id=vc(C,l,c,f)->id;
  349. switch(id){
  350. case 878:r878put_string(&ds,((T878*)C),a1);
  351.  
  352. break;
  353. case 2074:r2074put_string(&ds,((T2074*)C),a1);
  354.  
  355. break;
  356. default: error2(C,l,c,f);
  357. }
  358. }
  359. se_dst=caller;
  360. }
  361.  
  362.  
  363. void X878put_character(se_dump_stack*caller,int l,int c,int f, void *C,T3 a1){
  364. se_dump_stack ds=*caller;
  365. {int id=vc(C,l,c,f)->id;
  366. switch(id){
  367. case 878:r878put_character(&ds,((T878*)C),a1);
  368.  
  369. break;
  370. case 2074:r2074put_character(&ds,((T2074*)C),a1);
  371.  
  372. break;
  373. default: error2(C,l,c,f);
  374. }
  375. }
  376. se_dst=caller;
  377. }
  378.  
  379.  
  380. void X878put_integer(se_dump_stack*caller,int l,int c,int f, void *C,T2 a1){
  381. se_dump_stack ds=*caller;
  382. {int id=vc(C,l,c,f)->id;
  383. switch(id){
  384. case 878:r878put_integer(&ds,((T878*)C),a1);
  385.  
  386. break;
  387. case 2074:r2074put_integer(&ds,((T2074*)C),a1);
  388.  
  389. break;
  390. default: error2(C,l,c,f);
  391. }
  392. }
  393. se_dst=caller;
  394. }
  395.  
  396.