Kernel-Transcript.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. smalltalk.addPackage('Kernel-Transcript', {});
  2. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  3. smalltalk.addMethod(
  4. "_clear",
  5. smalltalk.method({
  6. selector: "clear",
  7. category: 'printing',
  8. fn: function (){
  9. var self=this;
  10. return self},
  11. args: [],
  12. source: "clear\x0a\x09\x22no op\x22",
  13. messageSends: [],
  14. referencedClasses: []
  15. }),
  16. smalltalk.ConsoleTranscript);
  17. smalltalk.addMethod(
  18. "_cr",
  19. smalltalk.method({
  20. selector: "cr",
  21. category: 'printing',
  22. fn: function (){
  23. var self=this;
  24. return self},
  25. args: [],
  26. source: "cr\x0a\x09\x22no op\x22",
  27. messageSends: [],
  28. referencedClasses: []
  29. }),
  30. smalltalk.ConsoleTranscript);
  31. smalltalk.addMethod(
  32. "_open",
  33. smalltalk.method({
  34. selector: "open",
  35. category: 'actions',
  36. fn: function (){
  37. var self=this;
  38. return self},
  39. args: [],
  40. source: "open",
  41. messageSends: [],
  42. referencedClasses: []
  43. }),
  44. smalltalk.ConsoleTranscript);
  45. smalltalk.addMethod(
  46. "_show_",
  47. smalltalk.method({
  48. selector: "show:",
  49. category: 'printing',
  50. fn: function (anObject){
  51. var self=this;
  52. var string;
  53. string=smalltalk.send(anObject,"_asString",[]);
  54. console.log(String(string));
  55. ;
  56. return self},
  57. args: ["anObject"],
  58. source: "show: anObject\x0a\x09| string |\x0a\x09string := anObject asString.\x0a\x09<console.log(String(string))>",
  59. messageSends: ["asString"],
  60. referencedClasses: []
  61. }),
  62. smalltalk.ConsoleTranscript);
  63. smalltalk.addMethod(
  64. "_initialize",
  65. smalltalk.method({
  66. selector: "initialize",
  67. category: 'initialization',
  68. fn: function (){
  69. var self=this;
  70. smalltalk.send((smalltalk.Transcript || Transcript),"_register_",[smalltalk.send(self,"_new",[])]);
  71. return self},
  72. args: [],
  73. source: "initialize\x0a\x09Transcript register: self new",
  74. messageSends: ["register:", "new"],
  75. referencedClasses: ["Transcript"]
  76. }),
  77. smalltalk.ConsoleTranscript.klass);
  78. smalltalk.addClass('Transcript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  79. smalltalk.Transcript.klass.iVarNames = ['current'];
  80. smalltalk.addMethod(
  81. "_clear",
  82. smalltalk.method({
  83. selector: "clear",
  84. category: 'printing',
  85. fn: function (){
  86. var self=this;
  87. smalltalk.send(smalltalk.send(self,"_current",[]),"_clear",[]);
  88. return self},
  89. args: [],
  90. source: "clear\x0a self current clear",
  91. messageSends: ["clear", "current"],
  92. referencedClasses: []
  93. }),
  94. smalltalk.Transcript.klass);
  95. smalltalk.addMethod(
  96. "_cr",
  97. smalltalk.method({
  98. selector: "cr",
  99. category: 'printing',
  100. fn: function (){
  101. var self=this;
  102. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[smalltalk.send((smalltalk.String || String),"_cr",[])]);
  103. return self},
  104. args: [],
  105. source: "cr\x0a self current show: String cr",
  106. messageSends: ["show:", "cr", "current"],
  107. referencedClasses: ["String"]
  108. }),
  109. smalltalk.Transcript.klass);
  110. smalltalk.addMethod(
  111. "_current",
  112. smalltalk.method({
  113. selector: "current",
  114. category: 'instance creation',
  115. fn: function (){
  116. var self=this;
  117. return self["@current"];
  118. },
  119. args: [],
  120. source: "current\x0a ^current",
  121. messageSends: [],
  122. referencedClasses: []
  123. }),
  124. smalltalk.Transcript.klass);
  125. smalltalk.addMethod(
  126. "_new",
  127. smalltalk.method({
  128. selector: "new",
  129. category: 'instance creation',
  130. fn: function (){
  131. var self=this;
  132. smalltalk.send(self,"_shouldNotImplement",[]);
  133. return self},
  134. args: [],
  135. source: "new\x0a self shouldNotImplement",
  136. messageSends: ["shouldNotImplement"],
  137. referencedClasses: []
  138. }),
  139. smalltalk.Transcript.klass);
  140. smalltalk.addMethod(
  141. "_open",
  142. smalltalk.method({
  143. selector: "open",
  144. category: 'instance creation',
  145. fn: function (){
  146. var self=this;
  147. smalltalk.send(smalltalk.send(self,"_current",[]),"_open",[]);
  148. return self},
  149. args: [],
  150. source: "open\x0a self current open",
  151. messageSends: ["open", "current"],
  152. referencedClasses: []
  153. }),
  154. smalltalk.Transcript.klass);
  155. smalltalk.addMethod(
  156. "_register_",
  157. smalltalk.method({
  158. selector: "register:",
  159. category: 'instance creation',
  160. fn: function (aTranscript){
  161. var self=this;
  162. self["@current"]=aTranscript;
  163. return self},
  164. args: ["aTranscript"],
  165. source: "register: aTranscript\x0a\x09current := aTranscript",
  166. messageSends: [],
  167. referencedClasses: []
  168. }),
  169. smalltalk.Transcript.klass);
  170. smalltalk.addMethod(
  171. "_show_",
  172. smalltalk.method({
  173. selector: "show:",
  174. category: 'printing',
  175. fn: function (anObject){
  176. var self=this;
  177. smalltalk.send(smalltalk.send(self,"_current",[]),"_show_",[anObject]);
  178. return self},
  179. args: ["anObject"],
  180. source: "show: anObject\x0a self current show: anObject",
  181. messageSends: ["show:", "current"],
  182. referencedClasses: []
  183. }),
  184. smalltalk.Transcript.klass);