append.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. #include "prescheme.h"
  5. char *string_append(char*, char*);
  6. long main(long, char**);
  7. char *string_append(char *a_0X, char *b_1X)
  8. {
  9. long arg0K1;
  10. long arg0K0;
  11. long src_8X;
  12. long tgt_7X;
  13. long src_6X;
  14. long tgt_5X;
  15. char *target_4X;
  16. long len_b_3X;
  17. long len_a_2X;
  18. { len_a_2X = strlen((char *) a_0X);
  19. len_b_3X = strlen((char *) b_1X);
  20. target_4X = (char *)calloc( 1, 1 + (len_a_2X + len_b_3X));
  21. arg0K0 = 0;
  22. arg0K1 = 0;
  23. goto L66;}
  24. L66: {
  25. tgt_5X = arg0K0;
  26. src_6X = arg0K1;
  27. if ((src_6X == len_a_2X)) {
  28. arg0K0 = len_a_2X;
  29. arg0K1 = 0;
  30. goto L84;}
  31. else {
  32. *(target_4X + tgt_5X) = (*(a_0X + src_6X));
  33. arg0K0 = (1 + tgt_5X);
  34. arg0K1 = (1 + src_6X);
  35. goto L66;}}
  36. L84: {
  37. tgt_7X = arg0K0;
  38. src_8X = arg0K1;
  39. if ((src_8X == len_b_3X)) {
  40. return target_4X;}
  41. else {
  42. *(target_4X + tgt_7X) = (*(b_1X + src_8X));
  43. arg0K0 = (1 + tgt_7X);
  44. arg0K1 = (1 + src_8X);
  45. goto L84;}}
  46. }
  47. long main(long argc_9X, char **argv_10X)
  48. {
  49. long arg0K1;
  50. long arg0K0;
  51. FILE * merged_arg2K2;
  52. char *merged_arg1K1;
  53. char *merged_arg1K0;
  54. #ifdef USE_DIRECT_THREADING
  55. void *demo_string_append_return_address;
  56. #else
  57. int demo_string_append_return_tag;
  58. #endif
  59. char demo_string_append0_return_value;
  60. char *a_11X;
  61. char *b_12X;
  62. FILE * out_13X;
  63. long src_24X;
  64. long tgt_23X;
  65. long src_22X;
  66. long tgt_21X;
  67. char *target_20X;
  68. long len_b_19X;
  69. long len_a_18X;
  70. FILE * out_17X;
  71. char *b_16X;
  72. char *a_15X;
  73. FILE * out_14X;
  74. { if ((3 == argc_9X)) {
  75. out_14X = stdout;
  76. a_15X = *(argv_10X + 1);
  77. b_16X = *(argv_10X + 2);
  78. merged_arg1K0 = a_15X;
  79. merged_arg1K1 = a_15X;
  80. merged_arg2K2 = out_14X;
  81. #ifdef USE_DIRECT_THREADING
  82. demo_string_append_return_address = &&demo_string_append_return_0;
  83. #else
  84. demo_string_append_return_tag = 0;
  85. #endif
  86. goto demo_string_append;
  87. demo_string_append_return_0:
  88. merged_arg1K0 = a_15X;
  89. merged_arg1K1 = b_16X;
  90. merged_arg2K2 = out_14X;
  91. #ifdef USE_DIRECT_THREADING
  92. demo_string_append_return_address = &&demo_string_append_return_1;
  93. #else
  94. demo_string_append_return_tag = 1;
  95. #endif
  96. goto demo_string_append;
  97. demo_string_append_return_1:
  98. merged_arg1K0 = b_16X;
  99. merged_arg1K1 = b_16X;
  100. merged_arg2K2 = out_14X;
  101. #ifdef USE_DIRECT_THREADING
  102. demo_string_append_return_address = &&demo_string_append_return_2;
  103. #else
  104. demo_string_append_return_tag = 2;
  105. #endif
  106. goto demo_string_append;
  107. demo_string_append_return_2:
  108. return 0;}
  109. else {
  110. out_17X = stderr;
  111. ps_write_string("Usage: ", out_17X);
  112. ps_write_string((*(argv_10X + 0)), out_17X);
  113. ps_write_string(" <string-a> <string-b>", out_17X);
  114. { long ignoreXX;
  115. PS_WRITE_CHAR(10, out_17X, ignoreXX) }
  116. ps_write_string(" Prints permutations of <string-a> and <string-b>.", out_17X);
  117. { long ignoreXX;
  118. PS_WRITE_CHAR(10, out_17X, ignoreXX) }
  119. return 1;}}
  120. demo_string_append: {
  121. a_11X = merged_arg1K0;
  122. b_12X = merged_arg1K1;
  123. out_13X = merged_arg2K2;{
  124. len_a_18X = strlen((char *) a_11X);
  125. len_b_19X = strlen((char *) b_12X);
  126. target_20X = (char *)calloc( 1, 1 + (len_a_18X + len_b_19X));
  127. arg0K0 = 0;
  128. arg0K1 = 0;
  129. goto L121;}
  130. L121: {
  131. tgt_21X = arg0K0;
  132. src_22X = arg0K1;
  133. if ((src_22X == len_a_18X)) {
  134. arg0K0 = len_a_18X;
  135. arg0K1 = 0;
  136. goto L131;}
  137. else {
  138. *(target_20X + tgt_21X) = (*(a_11X + src_22X));
  139. arg0K0 = (1 + tgt_21X);
  140. arg0K1 = (1 + src_22X);
  141. goto L121;}}
  142. L131: {
  143. tgt_23X = arg0K0;
  144. src_24X = arg0K1;
  145. if ((src_24X == len_b_19X)) {
  146. ps_write_string(target_20X, out_13X);
  147. { long ignoreXX;
  148. PS_WRITE_CHAR(10, out_13X, ignoreXX) }
  149. free(target_20X);
  150. demo_string_append0_return_value = 1;
  151. #ifdef USE_DIRECT_THREADING
  152. goto *demo_string_append_return_address;
  153. #else
  154. goto demo_string_append_return;
  155. #endif
  156. }
  157. else {
  158. *(target_20X + tgt_23X) = (*(b_12X + src_24X));
  159. arg0K0 = (1 + tgt_23X);
  160. arg0K1 = (1 + src_24X);
  161. goto L131;}}
  162. #ifndef USE_DIRECT_THREADING
  163. demo_string_append_return:
  164. switch (demo_string_append_return_tag) {
  165. case 0: goto demo_string_append_return_0;
  166. case 1: goto demo_string_append_return_1;
  167. default: goto demo_string_append_return_2;
  168. }
  169. #endif
  170. }
  171. }