2
0

Kernel-Transcript.js 6.0 KB

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