Kernel-Transcript.js 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222
  1. define("amber_core/Kernel-Transcript", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('Kernel-Transcript');
  3. smalltalk.packages["Kernel-Transcript"].transport = {"type":"amd","amdNamespace":"amber_core"};
  4. smalltalk.addClass('ConsoleTranscript', smalltalk.Object, ['textarea'], 'Kernel-Transcript');
  5. smalltalk.ConsoleTranscript.comment="I am a specific transcript emitting to the JavaScript console.\x0a\x0aIf no other transcript is registered, I am the default.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "clear",
  9. category: 'printing',
  10. fn: function (){
  11. var self=this;
  12. return smalltalk.withContext(function($ctx1) {
  13. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.ConsoleTranscript)})},
  14. args: [],
  15. source: "clear\x0a\x09\x22no op\x22",
  16. messageSends: [],
  17. referencedClasses: []
  18. }),
  19. smalltalk.ConsoleTranscript);
  20. smalltalk.addMethod(
  21. smalltalk.method({
  22. selector: "cr",
  23. category: 'printing',
  24. fn: function (){
  25. var self=this;
  26. return smalltalk.withContext(function($ctx1) {
  27. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.ConsoleTranscript)})},
  28. args: [],
  29. source: "cr\x0a\x09\x22no op\x22",
  30. messageSends: [],
  31. referencedClasses: []
  32. }),
  33. smalltalk.ConsoleTranscript);
  34. smalltalk.addMethod(
  35. smalltalk.method({
  36. selector: "open",
  37. category: 'actions',
  38. fn: function (){
  39. var self=this;
  40. return smalltalk.withContext(function($ctx1) {
  41. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.ConsoleTranscript)})},
  42. args: [],
  43. source: "open",
  44. messageSends: [],
  45. referencedClasses: []
  46. }),
  47. smalltalk.ConsoleTranscript);
  48. smalltalk.addMethod(
  49. smalltalk.method({
  50. selector: "show:",
  51. category: 'printing',
  52. fn: function (anObject){
  53. var self=this;
  54. return smalltalk.withContext(function($ctx1) {
  55. console.log(String(_st(anObject)._asString()));
  56. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.ConsoleTranscript)})},
  57. args: ["anObject"],
  58. source: "show: anObject\x0a\x22Smalltalk objects should have no trouble displaying themselves on the Transcript; Javascript objects don't know how, so must be wrapped in a JSObectProxy.\x22\x0a<console.log(String(_st(anObject)._asString()))>",
  59. messageSends: [],
  60. referencedClasses: []
  61. }),
  62. smalltalk.ConsoleTranscript);
  63. smalltalk.addMethod(
  64. smalltalk.method({
  65. selector: "initialize",
  66. category: 'initialization',
  67. fn: function (){
  68. var self=this;
  69. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  70. return smalltalk.withContext(function($ctx1) {
  71. _st($Transcript())._register_(self._new());
  72. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.ConsoleTranscript.klass)})},
  73. args: [],
  74. source: "initialize\x0a\x09Transcript register: self new",
  75. messageSends: ["register:", "new"],
  76. referencedClasses: ["Transcript"]
  77. }),
  78. smalltalk.ConsoleTranscript.klass);
  79. smalltalk.addClass('Transcript', smalltalk.Object, [], 'Kernel-Transcript');
  80. smalltalk.Transcript.comment="I am a facade for Transcript actions.\x0a\x0aI delegate actions to the currently registered transcript.\x0a\x0a## API\x0a\x0a Transcript \x0a show: 'hello world';\x0a cr;\x0a show: anObject.";
  81. smalltalk.Transcript.klass.iVarNames = ['current'];
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "clear",
  85. category: 'printing',
  86. fn: function (){
  87. var self=this;
  88. return smalltalk.withContext(function($ctx1) {
  89. _st(self._current())._clear();
  90. return self}, function($ctx1) {$ctx1.fill(self,"clear",{},smalltalk.Transcript.klass)})},
  91. args: [],
  92. source: "clear\x0a\x09self current clear",
  93. messageSends: ["clear", "current"],
  94. referencedClasses: []
  95. }),
  96. smalltalk.Transcript.klass);
  97. smalltalk.addMethod(
  98. smalltalk.method({
  99. selector: "cr",
  100. category: 'printing',
  101. fn: function (){
  102. var self=this;
  103. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  104. return smalltalk.withContext(function($ctx1) {
  105. _st(self._current())._show_(_st($String())._cr());
  106. return self}, function($ctx1) {$ctx1.fill(self,"cr",{},smalltalk.Transcript.klass)})},
  107. args: [],
  108. source: "cr\x0a\x09self current show: String cr",
  109. messageSends: ["show:", "current", "cr"],
  110. referencedClasses: ["String"]
  111. }),
  112. smalltalk.Transcript.klass);
  113. smalltalk.addMethod(
  114. smalltalk.method({
  115. selector: "current",
  116. category: 'instance creation',
  117. fn: function (){
  118. var self=this;
  119. return smalltalk.withContext(function($ctx1) {
  120. var $1;
  121. $1=self["@current"];
  122. return $1;
  123. }, function($ctx1) {$ctx1.fill(self,"current",{},smalltalk.Transcript.klass)})},
  124. args: [],
  125. source: "current\x0a\x09^current",
  126. messageSends: [],
  127. referencedClasses: []
  128. }),
  129. smalltalk.Transcript.klass);
  130. smalltalk.addMethod(
  131. smalltalk.method({
  132. selector: "inspect:",
  133. category: 'printing',
  134. fn: function (anObject){
  135. var self=this;
  136. return smalltalk.withContext(function($ctx1) {
  137. self._show_(anObject);
  138. return self}, function($ctx1) {$ctx1.fill(self,"inspect:",{anObject:anObject},smalltalk.Transcript.klass)})},
  139. args: ["anObject"],
  140. source: "inspect: anObject\x0a\x09self show: anObject",
  141. messageSends: ["show:"],
  142. referencedClasses: []
  143. }),
  144. smalltalk.Transcript.klass);
  145. smalltalk.addMethod(
  146. smalltalk.method({
  147. selector: "new",
  148. category: 'instance creation',
  149. fn: function (){
  150. var self=this;
  151. return smalltalk.withContext(function($ctx1) {
  152. self._shouldNotImplement();
  153. return self}, function($ctx1) {$ctx1.fill(self,"new",{},smalltalk.Transcript.klass)})},
  154. args: [],
  155. source: "new\x0a\x09self shouldNotImplement",
  156. messageSends: ["shouldNotImplement"],
  157. referencedClasses: []
  158. }),
  159. smalltalk.Transcript.klass);
  160. smalltalk.addMethod(
  161. smalltalk.method({
  162. selector: "open",
  163. category: 'instance creation',
  164. fn: function (){
  165. var self=this;
  166. return smalltalk.withContext(function($ctx1) {
  167. _st(self._current())._open();
  168. return self}, function($ctx1) {$ctx1.fill(self,"open",{},smalltalk.Transcript.klass)})},
  169. args: [],
  170. source: "open\x0a\x09self current open",
  171. messageSends: ["open", "current"],
  172. referencedClasses: []
  173. }),
  174. smalltalk.Transcript.klass);
  175. smalltalk.addMethod(
  176. smalltalk.method({
  177. selector: "register:",
  178. category: 'instance creation',
  179. fn: function (aTranscript){
  180. var self=this;
  181. return smalltalk.withContext(function($ctx1) {
  182. self["@current"]=aTranscript;
  183. return self}, function($ctx1) {$ctx1.fill(self,"register:",{aTranscript:aTranscript},smalltalk.Transcript.klass)})},
  184. args: ["aTranscript"],
  185. source: "register: aTranscript\x0a\x09current := aTranscript",
  186. messageSends: [],
  187. referencedClasses: []
  188. }),
  189. smalltalk.Transcript.klass);
  190. smalltalk.addMethod(
  191. smalltalk.method({
  192. selector: "show:",
  193. category: 'printing',
  194. fn: function (anObject){
  195. var self=this;
  196. return smalltalk.withContext(function($ctx1) {
  197. _st(self._current())._show_(anObject);
  198. return self}, function($ctx1) {$ctx1.fill(self,"show:",{anObject:anObject},smalltalk.Transcript.klass)})},
  199. args: ["anObject"],
  200. source: "show: anObject\x0a\x09self current show: anObject",
  201. messageSends: ["show:", "current"],
  202. referencedClasses: []
  203. }),
  204. smalltalk.Transcript.klass);
  205. });