Guest User

Untitled

a guest
Oct 18th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.83 KB | None | 0 0
  1. #include <./list.h>
  2. #include <sdk/lang/Exception.h>
  3. #include <sdk/lang/BufferIterator.h>
  4. #include <sdk/lang/System.h>
  5. #include <sdk/lang/Character.h>
  6. #include <sdk/lang/VarArgs.h>
  7. #include <sdk/lang/string.h>
  8. #include <sdk/lang/Iterators.h>
  9. #include <sdk/lang/Memory.h>
  10. #include <sdk/lang/Buffer.h>
  11. #include <sdk/lang/Numbers.h>
  12. #include <sdk/lang/Abstractions.h>
  13. #include <sdk/lang/Format.h>
  14. #include <sdk/lang/IO.h>
  15.  
  16. static lang_string__String* __strLit122;
  17. static lang_string__String* __strLit120;
  18.  
  19. void list__List_get(list__List* this, uint8_t* __genericReturn2, lang_Numbers__Int index) { ((list__ListClass *)((lang_core__Object *)this)->class)->get((list__List*)this, __genericReturn2, index); }
  20.  
  21. void list__List_set(list__List* this, lang_Numbers__Int index, uint8_t* element) { return (void) ((list__ListClass *)((lang_core__Object *)this)->class)->set((list__List*)this, index, element); }
  22.  
  23. void list__List___defaults__(list__List* this) { return (void) ((lang_core__ObjectClass *)((lang_core__Object *)this)->class)->__defaults__((lang_core__Object*)this); }
  24. list__List* list__List_new(lang_core__Class* X, lang_Numbers__SizeT size) {
  25.  
  26. list__List* this = ((list__List*) (lang_core__Class_alloc__class((lang_core__Class*) list__List_class())));
  27. this->X = X;
  28. list__List___defaults__(this);
  29. list__List_init((list__List*) this, size);
  30. return this;
  31. }
  32. void list__List___load__() {
  33. lang_core__Class___load__();
  34. }
  35.  
  36. void list__List_init(list__List* this, lang_Numbers__SizeT size) {
  37. this->size = size;
  38. this->data = (void*) lang_Memory__gc_malloc(this->X->size * size);
  39. }
  40.  
  41. void list__List_get_impl(list__List* this, uint8_t* __genericReturn2, lang_Numbers__Int index) {
  42. if (__genericReturn2) {
  43. lang_Memory__memcpy(__genericReturn2, &(this->data[index * this->X->size]), this->X->size);
  44. }
  45. return;
  46. }
  47.  
  48. void list__List_set_impl(list__List* this, lang_Numbers__Int index, uint8_t* element) {
  49. lang_Memory__memcpy(&(this->data[index * this->X->size]), element, this->X->size);
  50. }
  51.  
  52. void list__List___defaults___impl(list__List* this) {
  53. lang_core__Class___defaults___impl((lang_core__Class*) this);
  54. }
  55.  
  56. list__ListClass *list__List_class(){
  57. static int __done__ = 0;
  58. static list__ListClass class =
  59. {
  60. {
  61. {
  62. {
  63. { NULL },
  64. (lang_Numbers__SizeT) 0,
  65. (lang_Numbers__SizeT) 0,
  66. (lang_string__String*) 0,
  67. (lang_core__Class*) 0,
  68. },
  69. (void*) list__List___defaults___impl,
  70. (void*) lang_core__Object___destroy___impl,
  71. (void*) list__List___load__,
  72. },
  73. (void*) lang_core__Class_forCover,
  74. },
  75. (void*) list__List_new,
  76. (void*) list__List_get_impl,
  77. (void*) list__List_set_impl,
  78. };
  79. lang_core__Class *classPtr = (lang_core__Class *) &class;
  80. if(!__done__++){
  81. classPtr->instanceSize = sizeof(list__List);
  82. classPtr->size = sizeof(void*);
  83. classPtr->super = (lang_core__Class*) lang_core__Object_class();
  84. classPtr->name = (void*) lang_string__makeStringLiteral("List", 4);
  85. }
  86. return &class;
  87. }
  88. void list__Letter___load__() {
  89. lang_core__Class___load__();
  90. }
  91.  
  92. list__LetterClass *list__Letter_class(){
  93. static lang_core__Class* classPtr = NULL;
  94. if (!classPtr) {
  95. classPtr = (void*) lang_core__Class_forCover(sizeof(list__Letter), sizeof(list__Letter));
  96. classPtr->super = (lang_core__Class*) lang_core__Object_class();
  97. classPtr->name = (void*) lang_string__makeStringLiteral("Letter", 6);
  98. }
  99. return (void*) classPtr;
  100. }
  101.  
  102. list__Letter list__List___specialized1_get(list__List___specialized1* this, lang_Numbers__Int index) { return (list__Letter) ((list__List___specialized1Class *)((lang_core__Object *)this)->class)->get((list__List___specialized1*)this, index); }
  103.  
  104. void list__List___specialized1_set(list__List___specialized1* this, lang_Numbers__Int index, list__Letter element) { return (void) ((list__List___specialized1Class *)((lang_core__Object *)this)->class)->set((list__List___specialized1*)this, index, element); }
  105.  
  106. void list__List___specialized1___defaults__(list__List___specialized1* this) { return (void) ((lang_core__ObjectClass *)((lang_core__Object *)this)->class)->__defaults__((lang_core__Object*)this); }
  107. list__List___specialized1* list__List___specialized1_new(lang_Numbers__SizeT size) {
  108.  
  109. list__List___specialized1* this = ((list__List___specialized1*) (lang_core__Class_alloc__class((lang_core__Class*) list__List___specialized1_class())));
  110. this->X = (lang_core__Class*) list__Letter_class();
  111. list__List___specialized1___defaults__(this);
  112. list__List___specialized1_init((list__List___specialized1*) this, size);
  113. return this;
  114. }
  115. void list__List___specialized1___load__() {
  116. lang_core__Class___load__();
  117. }
  118.  
  119. void list__List___specialized1_init(list__List___specialized1* this, lang_Numbers__SizeT size) {
  120. this->size = size;
  121. this->data = (void*) lang_Memory__gc_malloc(this->X->size * size);
  122. }
  123.  
  124. list__Letter list__List___specialized1_get_impl(list__List___specialized1* this, lang_Numbers__Int index) {
  125. return this->data[index];
  126. }
  127.  
  128. void list__List___specialized1_set_impl(list__List___specialized1* this, lang_Numbers__Int index, list__Letter element) {
  129. lang_Memory__memcpy(&(this->data[index * this->X->size]), &(element), ((lang_core__Class*)list__Letter_class())->size);
  130. }
  131.  
  132. void list__List___specialized1___defaults___impl(list__List___specialized1* this) {
  133. lang_core__Class___defaults___impl((lang_core__Class*) this);
  134. }
  135.  
  136. list__List___specialized1Class *list__List___specialized1_class(){
  137. static int __done__ = 0;
  138. static list__List___specialized1Class class =
  139. {
  140. {
  141. {
  142. {
  143. { NULL },
  144. (lang_Numbers__SizeT) 0,
  145. (lang_Numbers__SizeT) 0,
  146. (lang_string__String*) 0,
  147. (lang_core__Class*) 0,
  148. },
  149. (void*) list__List___specialized1___defaults___impl,
  150. (void*) lang_core__Object___destroy___impl,
  151. (void*) list__List___specialized1___load__,
  152. },
  153. (void*) lang_core__Class_forCover,
  154. },
  155. (void*) list__List___specialized1_new,
  156. (void*) list__List___specialized1_get_impl,
  157. (void*) list__List___specialized1_set_impl,
  158. };
  159. lang_core__Class *classPtr = (lang_core__Class *) &class;
  160. if(!__done__++){
  161. classPtr->instanceSize = sizeof(list__List___specialized1);
  162. classPtr->size = sizeof(void*);
  163. classPtr->super = (lang_core__Class*) lang_core__Object_class();
  164. classPtr->name = (void*) lang_string__makeStringLiteral("List___specialized1", 19);
  165. }
  166. return &class;
  167. }
  168. void list_load() {
  169. static int __done__ = 0;
  170. if (!__done__++){
  171. lang_Exception_load();
  172. lang_BufferIterator_load();
  173. lang_System_load();
  174. lang_Character_load();
  175. lang_VarArgs_load();
  176. lang_core_load();
  177. lang_string_load();
  178. lang_Iterators_load();
  179. lang_Memory_load();
  180. lang_Buffer_load();
  181. lang_Numbers_load();
  182. lang_Abstractions_load();
  183. lang_Format_load();
  184. lang_IO_load();
  185. list__List___load__();
  186. list__Letter___load__();
  187. list__List___specialized1___load__();
  188. __strLit122 = (void*) lang_string__makeStringLiteral("%c", 2);
  189. __strLit120 = (void*) lang_string__makeStringLiteral("%c", 2);
  190. }
  191. }
  192.  
  193.  
  194. void list__test1() {
  195. list__List* l = list__List_new((lang_core__Class*)lang_Character__Char_class(), 3);
  196. lang_Character__Char __genArg117 = 'f';
  197. list__List_set(l, 0, (uint8_t*) &(__genArg117));
  198. lang_Character__Char __genArg118 = 'a';
  199. list__List_set(l, 1, (uint8_t*) &(__genArg118));
  200. lang_Character__Char __genArg119 = 'q';
  201. list__List_set(l, 2, (uint8_t*) &(__genArg119));
  202.  
  203. {
  204. lang_Numbers__Int i;
  205. for (i = 0; i < l->size; i++) {
  206. lang_Character__Char __genCall121;
  207. lang_IO__printf(lang_string____OP_AS_String__Char__star(__strLit120), (list__List_get(l, (uint8_t*) &(__genCall121), i), __genCall121));
  208. }
  209. }
  210. lang_IO__println();
  211. }
  212.  
  213. void list__test2() {
  214. list__List___specialized1* l = list__List___specialized1_new(3);
  215. list__List___specialized1_set(l, 0, ((list__Letter) ('f')));
  216. list__List___specialized1_set(l, 1, ((list__Letter) ('a')));
  217. list__List___specialized1_set(l, 2, ((list__Letter) ('q')));
  218.  
  219. {
  220. lang_Numbers__Int i;
  221. for (i = 0; i < l->size; i++) {
  222. lang_IO__printf(lang_string____OP_AS_String__Char__star(__strLit122), list__List___specialized1_get(l, i));
  223. }
  224. }
  225. lang_IO__println();
  226. }
  227.  
  228. lang_Numbers__Int main() {
  229. GC_INIT();
  230. list_load();
  231. list__test1();
  232. list__test2();
  233. return ((lang_Numbers__Int) (0));
  234. }
Add Comment
Please, Sign In to add comment