recfun.c 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  1. #include "prescheme.h"
  2. #include "ps-init.h"
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5. #include <string.h>
  6. struct vec2 {
  7. long x;
  8. long y;
  9. };
  10. struct rect {
  11. struct vec2 *tl;
  12. struct vec2 *wh;
  13. };
  14. long write_vec2(struct vec2 *, FILE *);
  15. long write_rect(struct rect *, FILE *);
  16. long main(void);
  17. long write_vec2(struct vec2 *a_0X, FILE *port_1X) {
  18. long v_2X;
  19. {
  20. ps_write_string("#<vec2 ", port_1X);
  21. ps_write_integer((a_0X->x), port_1X);
  22. {
  23. long ignoreXX;
  24. PS_WRITE_CHAR(32, port_1X, ignoreXX)
  25. }
  26. ps_write_integer((a_0X->y), port_1X);
  27. PS_WRITE_CHAR(62, port_1X, v_2X)
  28. return v_2X;
  29. }
  30. }
  31. long write_rect(struct rect *a_3X, FILE *port_4X) {
  32. long v_5X;
  33. {
  34. ps_write_string("#<rect ", port_4X);
  35. ps_write_integer(((a_3X->tl)->x), port_4X);
  36. {
  37. long ignoreXX;
  38. PS_WRITE_CHAR(32, port_4X, ignoreXX)
  39. }
  40. ps_write_integer(((a_3X->tl)->y), port_4X);
  41. {
  42. long ignoreXX;
  43. PS_WRITE_CHAR(32, port_4X, ignoreXX)
  44. }
  45. ps_write_integer(((a_3X->wh)->x), port_4X);
  46. {
  47. long ignoreXX;
  48. PS_WRITE_CHAR(32, port_4X, ignoreXX)
  49. }
  50. ps_write_integer(((a_3X->wh)->y), port_4X);
  51. PS_WRITE_CHAR(62, port_4X, v_5X)
  52. return v_5X;
  53. }
  54. }
  55. long main(void) {
  56. struct rect *arg1K0;
  57. struct vec2 *arg0K0;
  58. FILE *merged_arg3K2;
  59. struct vec2 *merged_arg0K1;
  60. char *merged_arg2K0;
  61. #ifdef USE_DIRECT_THREADING
  62. void *write_cornerD0_return_address;
  63. #else
  64. int write_cornerD0_return_tag;
  65. #endif
  66. char *name_6X;
  67. struct vec2 *corner_7X;
  68. FILE *out_8X;
  69. struct vec2 *v_31X;
  70. struct vec2 *vec2_30X;
  71. long y_29X;
  72. long x_28X;
  73. struct vec2 *v_27X;
  74. struct vec2 *vec2_26X;
  75. long y_25X;
  76. long x_24X;
  77. struct vec2 *v_23X;
  78. struct vec2 *vec2_22X;
  79. long y_21X;
  80. long x_20X;
  81. struct vec2 *v_19X;
  82. struct vec2 *vec2_18X;
  83. long y_17X;
  84. long x_16X;
  85. struct rect *a_15X;
  86. struct rect *rect_14X;
  87. struct vec2 *wh_13X;
  88. struct vec2 *vec2_12X;
  89. struct vec2 *tl_11X;
  90. struct vec2 *vec2_10X;
  91. FILE *out_9X;
  92. {
  93. out_9X = stdout;
  94. vec2_10X = (struct vec2 *)malloc(sizeof(struct vec2));
  95. if ((NULL == vec2_10X)) {
  96. arg0K0 = vec2_10X;
  97. goto L389;
  98. } else {
  99. vec2_10X->x = 10;
  100. vec2_10X->y = 10;
  101. arg0K0 = vec2_10X;
  102. goto L389;
  103. }
  104. }
  105. L389 : {
  106. tl_11X = arg0K0;
  107. vec2_12X = (struct vec2 *)malloc(sizeof(struct vec2));
  108. if ((NULL == vec2_12X)) {
  109. arg0K0 = vec2_12X;
  110. goto L391;
  111. } else {
  112. vec2_12X->x = 2;
  113. vec2_12X->y = 2;
  114. arg0K0 = vec2_12X;
  115. goto L391;
  116. }
  117. }
  118. L391 : {
  119. wh_13X = arg0K0;
  120. rect_14X = (struct rect *)malloc(sizeof(struct rect));
  121. if ((NULL == rect_14X)) {
  122. arg1K0 = rect_14X;
  123. goto L393;
  124. } else {
  125. rect_14X->tl = tl_11X;
  126. rect_14X->wh = wh_13X;
  127. arg1K0 = rect_14X;
  128. goto L393;
  129. }
  130. }
  131. L393 : {
  132. a_15X = arg1K0;
  133. write_rect(a_15X, out_9X);
  134. {
  135. long ignoreXX;
  136. PS_WRITE_CHAR(10, out_9X, ignoreXX)
  137. }
  138. x_16X = (a_15X->tl)->x;
  139. y_17X = (a_15X->tl)->y;
  140. vec2_18X = (struct vec2 *)malloc(sizeof(struct vec2));
  141. if ((NULL == vec2_18X)) {
  142. arg0K0 = vec2_18X;
  143. goto L417;
  144. } else {
  145. vec2_18X->x = x_16X;
  146. vec2_18X->y = y_17X;
  147. arg0K0 = vec2_18X;
  148. goto L417;
  149. }
  150. }
  151. L417 : {
  152. v_19X = arg0K0;
  153. merged_arg2K0 = "top-left";
  154. merged_arg0K1 = v_19X;
  155. merged_arg3K2 = out_9X;
  156. #ifdef USE_DIRECT_THREADING
  157. write_cornerD0_return_address = &&write_cornerD0_return_0;
  158. #else
  159. write_cornerD0_return_tag = 0;
  160. #endif
  161. goto write_cornerD0;
  162. write_cornerD0_return_0:
  163. x_20X = ((a_15X->tl)->x) + ((a_15X->wh)->x);
  164. y_21X = (a_15X->tl)->y;
  165. vec2_22X = (struct vec2 *)malloc(sizeof(struct vec2));
  166. if ((NULL == vec2_22X)) {
  167. arg0K0 = vec2_22X;
  168. goto L421;
  169. } else {
  170. vec2_22X->x = x_20X;
  171. vec2_22X->y = y_21X;
  172. arg0K0 = vec2_22X;
  173. goto L421;
  174. }
  175. }
  176. L421 : {
  177. v_23X = arg0K0;
  178. merged_arg2K0 = "top-right";
  179. merged_arg0K1 = v_23X;
  180. merged_arg3K2 = out_9X;
  181. #ifdef USE_DIRECT_THREADING
  182. write_cornerD0_return_address = &&write_cornerD0_return_1;
  183. #else
  184. write_cornerD0_return_tag = 1;
  185. #endif
  186. goto write_cornerD0;
  187. write_cornerD0_return_1:
  188. x_24X = (a_15X->tl)->x;
  189. y_25X = ((a_15X->tl)->y) + ((a_15X->wh)->y);
  190. vec2_26X = (struct vec2 *)malloc(sizeof(struct vec2));
  191. if ((NULL == vec2_26X)) {
  192. arg0K0 = vec2_26X;
  193. goto L425;
  194. } else {
  195. vec2_26X->x = x_24X;
  196. vec2_26X->y = y_25X;
  197. arg0K0 = vec2_26X;
  198. goto L425;
  199. }
  200. }
  201. L425 : {
  202. v_27X = arg0K0;
  203. merged_arg2K0 = "bottom-left";
  204. merged_arg0K1 = v_27X;
  205. merged_arg3K2 = out_9X;
  206. #ifdef USE_DIRECT_THREADING
  207. write_cornerD0_return_address = &&write_cornerD0_return_2;
  208. #else
  209. write_cornerD0_return_tag = 2;
  210. #endif
  211. goto write_cornerD0;
  212. write_cornerD0_return_2:
  213. x_28X = ((a_15X->tl)->x) + ((a_15X->wh)->x);
  214. y_29X = ((a_15X->tl)->y) + ((a_15X->wh)->y);
  215. vec2_30X = (struct vec2 *)malloc(sizeof(struct vec2));
  216. if ((NULL == vec2_30X)) {
  217. arg0K0 = vec2_30X;
  218. goto L429;
  219. } else {
  220. vec2_30X->x = x_28X;
  221. vec2_30X->y = y_29X;
  222. arg0K0 = vec2_30X;
  223. goto L429;
  224. }
  225. }
  226. L429 : {
  227. v_31X = arg0K0;
  228. merged_arg2K0 = "bottom-right";
  229. merged_arg0K1 = v_31X;
  230. merged_arg3K2 = out_9X;
  231. #ifdef USE_DIRECT_THREADING
  232. write_cornerD0_return_address = &&write_cornerD0_return_3;
  233. #else
  234. write_cornerD0_return_tag = 3;
  235. #endif
  236. goto write_cornerD0;
  237. write_cornerD0_return_3:
  238. return 0;
  239. }
  240. write_cornerD0 : {
  241. name_6X = merged_arg2K0;
  242. corner_7X = merged_arg0K1;
  243. out_8X = merged_arg3K2;
  244. {
  245. ps_write_string(name_6X, out_8X);
  246. ps_write_string(": ", out_8X);
  247. write_vec2(corner_7X, out_8X);
  248. {
  249. long ignoreXX;
  250. PS_WRITE_CHAR(10, out_8X, ignoreXX)
  251. }
  252. free(corner_7X);
  253. #ifdef USE_DIRECT_THREADING
  254. goto *write_cornerD0_return_address;
  255. #else
  256. goto write_cornerD0_return;
  257. #endif
  258. }
  259. #ifndef USE_DIRECT_THREADING
  260. write_cornerD0_return:
  261. switch (write_cornerD0_return_tag) {
  262. case 0:
  263. goto write_cornerD0_return_0;
  264. case 1:
  265. goto write_cornerD0_return_1;
  266. case 2:
  267. goto write_cornerD0_return_2;
  268. default:
  269. goto write_cornerD0_return_3;
  270. }
  271. #endif
  272. }
  273. }