AmberCli.js 131 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807
  1. define("amber_cli/AmberCli", ["amber_vm/smalltalk", "amber_vm/nil", "amber_vm/_st", "amber_core/Kernel-Objects"], function(smalltalk,nil,_st){
  2. smalltalk.addPackage('AmberCli');
  3. smalltalk.packages["AmberCli"].transport = {"type":"amd","amdNamespace":"amber_cli"};
  4. smalltalk.addClass('AmberCli', smalltalk.Object, [], 'AmberCli');
  5. smalltalk.AmberCli.comment="I am the Amber CLI (CommandLine Interface) tool which runs on Node.js.\x0a\x0aMy responsibility is to start different Amber programs like the FileServer or the Repl.\x0aWhich program to start is determined by the first commandline parameters passed to the AmberCli executable.\x0aUse `help` to get a list of all available options.\x0aAny further commandline parameters are passed to the specific program.\x0a\x0a## Commands\x0a\x0aNew commands can be added by creating a class side method in the `commands` protocol which takes one parameter.\x0aThis parameter is an array of all commandline options + values passed on to the program.\x0aAny `camelCaseCommand` is transformed into a commandline parameter of the form `camel-case-command` and vice versa.";
  6. smalltalk.addMethod(
  7. smalltalk.method({
  8. selector: "commandLineSwitches",
  9. category: 'commandline',
  10. fn: function (){
  11. var self=this;
  12. var switches;
  13. return smalltalk.withContext(function($ctx1) {
  14. var $1;
  15. switches=_st(_st(self._class())._methodsInProtocol_("commands"))._collect_((function(each){
  16. return smalltalk.withContext(function($ctx2) {
  17. return _st(each)._selector();
  18. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  19. $ctx1.sendIdx["collect:"]=1;
  20. switches=_st(switches)._select_((function(each){
  21. return smalltalk.withContext(function($ctx2) {
  22. return _st(each)._match_("^[^:]*:$");
  23. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  24. switches=_st(switches)._collect_((function(each){
  25. return smalltalk.withContext(function($ctx2) {
  26. return _st(_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1"))._asLowercase();
  27. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  28. $1=switches;
  29. return $1;
  30. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.AmberCli.klass)})},
  31. args: [],
  32. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'commands' protocol of the class\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self class methodsInProtocol: 'commands') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase].\x0a\x09^switches",
  33. messageSends: ["collect:", "methodsInProtocol:", "class", "selector", "select:", "match:", "asLowercase", "replace:with:", "allButLast"],
  34. referencedClasses: []
  35. }),
  36. smalltalk.AmberCli.klass);
  37. smalltalk.addMethod(
  38. smalltalk.method({
  39. selector: "handleArguments:",
  40. category: 'commandline',
  41. fn: function (args){
  42. var self=this;
  43. var selector;
  44. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  45. return smalltalk.withContext(function($ctx1) {
  46. var $1,$2,$3;
  47. $1=_st(args)._first();
  48. $ctx1.sendIdx["first"]=1;
  49. selector=self._selectorForCommandLineSwitch_($1);
  50. $2=args;
  51. $3=_st(args)._first();
  52. _st($2)._remove_($3);
  53. self._perform_withArguments_(selector,_st($Array())._with_(args));
  54. return self}, function($ctx1) {$ctx1.fill(self,"handleArguments:",{args:args,selector:selector},smalltalk.AmberCli.klass)})},
  55. args: ["args"],
  56. source: "handleArguments: args\x0a\x09| selector |\x0a\x0a\x09selector := self selectorForCommandLineSwitch: (args first).\x0a\x09args remove: args first.\x0a\x09self perform: selector withArguments: (Array with: args)",
  57. messageSends: ["selectorForCommandLineSwitch:", "first", "remove:", "perform:withArguments:", "with:"],
  58. referencedClasses: ["Array"]
  59. }),
  60. smalltalk.AmberCli.klass);
  61. smalltalk.addMethod(
  62. smalltalk.method({
  63. selector: "help:",
  64. category: 'commands',
  65. fn: function (args){
  66. var self=this;
  67. return smalltalk.withContext(function($ctx1) {
  68. var $1;
  69. $1=_st(console)._log_("Available Commands:");
  70. $ctx1.sendIdx["log:"]=1;
  71. _st(self._commandLineSwitches())._do_((function(each){
  72. return smalltalk.withContext(function($ctx2) {
  73. return _st(console)._log_(each);
  74. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  75. return self}, function($ctx1) {$ctx1.fill(self,"help:",{args:args},smalltalk.AmberCli.klass)})},
  76. args: ["args"],
  77. source: "help: args\x0a\x09console log: 'Available Commands:'.\x0a\x09self commandLineSwitches do: [ :each | console log: each ]",
  78. messageSends: ["log:", "do:", "commandLineSwitches"],
  79. referencedClasses: []
  80. }),
  81. smalltalk.AmberCli.klass);
  82. smalltalk.addMethod(
  83. smalltalk.method({
  84. selector: "main",
  85. category: 'startup',
  86. fn: function (){
  87. var self=this;
  88. var args,nodeMinorVersion;
  89. return smalltalk.withContext(function($ctx1) {
  90. var $3,$2,$1,$4,$5,$7,$6,$8,$9;
  91. $3=_st(process)._version();
  92. $ctx1.sendIdx["version"]=1;
  93. $2=_st($3)._tokenize_(".");
  94. $1=_st($2)._second();
  95. nodeMinorVersion=_st($1)._asNumber();
  96. $4=_st(nodeMinorVersion).__lt((8));
  97. if(smalltalk.assert($4)){
  98. $5=console;
  99. $7=_st(process)._version();
  100. $6="You are currently using Node.js ".__comma($7);
  101. _st($5)._log_($6);
  102. $ctx1.sendIdx["log:"]=1;
  103. _st(console)._log_("Required is at least Node.js v0.8.x or greater.");
  104. return (-1);
  105. };
  106. args=_st(process)._argv();
  107. _st(args)._removeFrom_to_((1),(2));
  108. $8=_st(args)._isEmpty();
  109. if(smalltalk.assert($8)){
  110. self._help_(nil);
  111. } else {
  112. $9=self._handleArguments_(args);
  113. return $9;
  114. };
  115. return self}, function($ctx1) {$ctx1.fill(self,"main",{args:args,nodeMinorVersion:nodeMinorVersion},smalltalk.AmberCli.klass)})},
  116. args: [],
  117. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09Parses commandline arguments and starts the according subprogram.\x22\x0a\x09| args nodeMinorVersion |\x0a\x0a\x09nodeMinorVersion := ((process version) tokenize: '.') second asNumber.\x0a\x09nodeMinorVersion < 8 ifTrue: [\x0a\x09\x09console log: 'You are currently using Node.js ', (process version).\x0a\x09\x09console log: 'Required is at least Node.js v0.8.x or greater.'.\x0a\x09\x09^ -1.\x0a\x09].\x0a\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 2.\x0a\x09\x0a\x09(args isEmpty)\x0a\x09\x09ifTrue: [self help: nil]\x0a\x09\x09ifFalse: [^self handleArguments: args]",
  118. messageSends: ["asNumber", "second", "tokenize:", "version", "ifTrue:", "<", "log:", ",", "argv", "removeFrom:to:", "ifTrue:ifFalse:", "isEmpty", "help:", "handleArguments:"],
  119. referencedClasses: []
  120. }),
  121. smalltalk.AmberCli.klass);
  122. smalltalk.addMethod(
  123. smalltalk.method({
  124. selector: "repl:",
  125. category: 'commands',
  126. fn: function (args){
  127. var self=this;
  128. function $Repl(){return smalltalk.Repl||(typeof Repl=="undefined"?nil:Repl)}
  129. return smalltalk.withContext(function($ctx1) {
  130. var $1;
  131. $1=_st(_st($Repl())._new())._createInterface();
  132. return $1;
  133. }, function($ctx1) {$ctx1.fill(self,"repl:",{args:args},smalltalk.AmberCli.klass)})},
  134. args: ["args"],
  135. source: "repl: args\x0a\x09^Repl new createInterface",
  136. messageSends: ["createInterface", "new"],
  137. referencedClasses: ["Repl"]
  138. }),
  139. smalltalk.AmberCli.klass);
  140. smalltalk.addMethod(
  141. smalltalk.method({
  142. selector: "selectorForCommandLineSwitch:",
  143. category: 'commandline',
  144. fn: function (aSwitch){
  145. var self=this;
  146. var command,selector;
  147. return smalltalk.withContext(function($ctx1) {
  148. var $1,$2;
  149. $1=_st(self._commandLineSwitches())._includes_(aSwitch);
  150. if(smalltalk.assert($1)){
  151. selector=_st(_st(aSwitch)._replace_with_("-[a-z]",(function(each){
  152. return smalltalk.withContext(function($ctx2) {
  153. return _st(_st(each)._second())._asUppercase();
  154. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}))).__comma(":");
  155. selector;
  156. } else {
  157. selector="help:";
  158. selector;
  159. };
  160. $2=selector;
  161. return $2;
  162. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch,command:command,selector:selector},smalltalk.AmberCli.klass)})},
  163. args: ["aSwitch"],
  164. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Add ':' at the end and replace all occurences of a lowercase letter preceded by a '-' with the Uppercase letter.\x0a\x09 Example: fallback-page becomes fallbackPage:.\x0a\x09 If no correct selector is found return 'help:'\x22\x0a\x09 | command selector |\x0a\x0a\x09 (self commandLineSwitches includes: aSwitch)\x0a\x09 ifTrue: [ selector := (aSwitch replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':']\x0a\x09 ifFalse: [ selector := 'help:' ].\x0a\x09^selector",
  165. messageSends: ["ifTrue:ifFalse:", "includes:", "commandLineSwitches", ",", "replace:with:", "asUppercase", "second"],
  166. referencedClasses: []
  167. }),
  168. smalltalk.AmberCli.klass);
  169. smalltalk.addMethod(
  170. smalltalk.method({
  171. selector: "serve:",
  172. category: 'commands',
  173. fn: function (args){
  174. var self=this;
  175. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  176. return smalltalk.withContext(function($ctx1) {
  177. var $1;
  178. $1=_st(_st($FileServer())._createServerWithArguments_(args))._start();
  179. return $1;
  180. }, function($ctx1) {$ctx1.fill(self,"serve:",{args:args},smalltalk.AmberCli.klass)})},
  181. args: ["args"],
  182. source: "serve: args\x0a\x09^(FileServer createServerWithArguments: args) start",
  183. messageSends: ["start", "createServerWithArguments:"],
  184. referencedClasses: ["FileServer"]
  185. }),
  186. smalltalk.AmberCli.klass);
  187. smalltalk.addClass('FileServer', smalltalk.Object, ['path', 'http', 'fs', 'url', 'host', 'port', 'basePath', 'util', 'username', 'password', 'fallbackPage'], 'AmberCli');
  188. smalltalk.FileServer.comment="I am the Amber Smalltalk FileServer.\x0aMy runtime requirement is a functional Node.js executable.\x0a\x0aTo start a FileServer instance on port `4000` use the following code:\x0a\x0a FileServer new start\x0a\x0aA parameterized instance can be created with the following code:\x0a\x0a FileServer createServerWithArguments: options\x0a\x0aHere, `options` is an array of commandline style strings each followed by a value e.g. `#('--port', '6000', '--host', '0.0.0.0')`.\x0aA list of all available parameters can be printed to the commandline by passing `--help` as parameter.\x0aSee the `Options` section for further details on how options are mapped to instance methods.\x0a\x0aAfter startup FileServer checks if the directory layout required by Amber is present and logs a warning on absence.\x0a\x0a\x0a## Options\x0a\x0aEach option is of the form `--some-option-string` which is transformed into a selector of the format `someOptionString:`.\x0aThe trailing `--` gets removed, each `-[a-z]` gets transformed into the according uppercase letter, and a `:` is appended to create a selector which takes a single argument.\x0aAfterwards, the selector gets executed on the `FileServer` instance with the value following in the options array as parameter.\x0a\x0a## Adding new commandline parameters\x0a\x0aAdding new commandline parameters to `FileServer` is as easy as adding a new single parameter method to the `accessing` protocol.";
  189. smalltalk.addMethod(
  190. smalltalk.method({
  191. selector: "base64Decode:",
  192. category: 'private',
  193. fn: function (aString){
  194. var self=this;
  195. return smalltalk.withContext(function($ctx1) {
  196. return (new Buffer(aString, 'base64').toString());
  197. return self}, function($ctx1) {$ctx1.fill(self,"base64Decode:",{aString:aString},smalltalk.FileServer)})},
  198. args: ["aString"],
  199. source: "base64Decode: aString\x0a\x09<return (new Buffer(aString, 'base64').toString())>",
  200. messageSends: [],
  201. referencedClasses: []
  202. }),
  203. smalltalk.FileServer);
  204. smalltalk.addMethod(
  205. smalltalk.method({
  206. selector: "basePath",
  207. category: 'accessing',
  208. fn: function (){
  209. var self=this;
  210. return smalltalk.withContext(function($ctx1) {
  211. var $2,$1;
  212. $2=self["@basePath"];
  213. if(($receiver = $2) == nil || $receiver == null){
  214. $1="./";
  215. } else {
  216. $1=$2;
  217. };
  218. return $1;
  219. }, function($ctx1) {$ctx1.fill(self,"basePath",{},smalltalk.FileServer)})},
  220. args: [],
  221. source: "basePath\x0a\x09^basePath ifNil: ['./']",
  222. messageSends: ["ifNil:"],
  223. referencedClasses: []
  224. }),
  225. smalltalk.FileServer);
  226. smalltalk.addMethod(
  227. smalltalk.method({
  228. selector: "basePath:",
  229. category: 'accessing',
  230. fn: function (aString){
  231. var self=this;
  232. return smalltalk.withContext(function($ctx1) {
  233. self["@basePath"]=aString;
  234. return self}, function($ctx1) {$ctx1.fill(self,"basePath:",{aString:aString},smalltalk.FileServer)})},
  235. args: ["aString"],
  236. source: "basePath: aString\x0a\x09basePath := aString",
  237. messageSends: [],
  238. referencedClasses: []
  239. }),
  240. smalltalk.FileServer);
  241. smalltalk.addMethod(
  242. smalltalk.method({
  243. selector: "checkDirectoryLayout",
  244. category: 'initialization',
  245. fn: function (){
  246. var self=this;
  247. return smalltalk.withContext(function($ctx1) {
  248. var $3,$5,$4,$2,$1,$8,$10,$9,$7,$6,$13,$15,$14,$12,$11;
  249. $3=self["@fs"];
  250. $5=self._basePath();
  251. $ctx1.sendIdx["basePath"]=1;
  252. $4=_st($5).__comma("index.html");
  253. $ctx1.sendIdx[","]=1;
  254. $2=_st($3)._existsSync_($4);
  255. $ctx1.sendIdx["existsSync:"]=1;
  256. if(! smalltalk.assert($2)){
  257. $1=_st(console)._warn_("Warning: project directory does not contain index.html");
  258. $ctx1.sendIdx["warn:"]=1;
  259. };
  260. $8=self["@fs"];
  261. $10=self._basePath();
  262. $ctx1.sendIdx["basePath"]=2;
  263. $9=_st($10).__comma("st");
  264. $ctx1.sendIdx[","]=2;
  265. $7=_st($8)._existsSync_($9);
  266. $ctx1.sendIdx["existsSync:"]=2;
  267. if(! smalltalk.assert($7)){
  268. $6=_st(console)._warn_("Warning: project directory is missing an \x22st\x22 directory");
  269. $ctx1.sendIdx["warn:"]=2;
  270. };
  271. $13=self["@fs"];
  272. $15=self._basePath();
  273. $14=_st($15).__comma("js");
  274. $12=_st($13)._existsSync_($14);
  275. if(! smalltalk.assert($12)){
  276. $11=_st(console)._warn_("Warning: project directory is missing a \x22js\x22 directory");
  277. };
  278. return self}, function($ctx1) {$ctx1.fill(self,"checkDirectoryLayout",{},smalltalk.FileServer)})},
  279. args: [],
  280. source: "checkDirectoryLayout\x0a\x09(fs existsSync: self basePath, 'index.html') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory does not contain index.html'].\x0a\x09(fs existsSync: self basePath, 'st') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing an \x22st\x22 directory'].\x0a\x09(fs existsSync: self basePath, 'js') ifFalse: [\x0a\x09\x09console warn: 'Warning: project directory is missing a \x22js\x22 directory'].",
  281. messageSends: ["ifFalse:", "existsSync:", ",", "basePath", "warn:"],
  282. referencedClasses: []
  283. }),
  284. smalltalk.FileServer);
  285. smalltalk.addMethod(
  286. smalltalk.method({
  287. selector: "fallbackPage",
  288. category: 'accessing',
  289. fn: function (){
  290. var self=this;
  291. return smalltalk.withContext(function($ctx1) {
  292. var $1;
  293. $1=self["@fallbackPage"];
  294. return $1;
  295. }, function($ctx1) {$ctx1.fill(self,"fallbackPage",{},smalltalk.FileServer)})},
  296. args: [],
  297. source: "fallbackPage\x0a\x09^fallbackPage",
  298. messageSends: [],
  299. referencedClasses: []
  300. }),
  301. smalltalk.FileServer);
  302. smalltalk.addMethod(
  303. smalltalk.method({
  304. selector: "fallbackPage:",
  305. category: 'accessing',
  306. fn: function (aString){
  307. var self=this;
  308. return smalltalk.withContext(function($ctx1) {
  309. self["@fallbackPage"]=aString;
  310. return self}, function($ctx1) {$ctx1.fill(self,"fallbackPage:",{aString:aString},smalltalk.FileServer)})},
  311. args: ["aString"],
  312. source: "fallbackPage: aString\x0a\x09fallbackPage := aString",
  313. messageSends: [],
  314. referencedClasses: []
  315. }),
  316. smalltalk.FileServer);
  317. smalltalk.addMethod(
  318. smalltalk.method({
  319. selector: "handleGETRequest:respondTo:",
  320. category: 'request handling',
  321. fn: function (aRequest,aResponse){
  322. var self=this;
  323. var uri,filename;
  324. return smalltalk.withContext(function($ctx1) {
  325. var $1;
  326. uri=_st(_st(self["@url"])._parse_(_st(aRequest)._url()))._pathname();
  327. filename=_st(self["@path"])._join_with_(self._basePath(),uri);
  328. _st(self["@fs"])._exists_do_(filename,(function(aBoolean){
  329. return smalltalk.withContext(function($ctx2) {
  330. $1=aBoolean;
  331. if(smalltalk.assert($1)){
  332. return self._respondFileNamed_to_(filename,aResponse);
  333. } else {
  334. return self._respondNotFoundTo_(aResponse);
  335. };
  336. }, function($ctx2) {$ctx2.fillBlock({aBoolean:aBoolean},$ctx1,1)})}));
  337. return self}, function($ctx1) {$ctx1.fill(self,"handleGETRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,uri:uri,filename:filename},smalltalk.FileServer)})},
  338. args: ["aRequest", "aResponse"],
  339. source: "handleGETRequest: aRequest respondTo: aResponse\x0a\x09| uri filename |\x0a\x09uri := (url parse: aRequest url) pathname.\x0a\x09filename := path join: self basePath with: uri.\x0a\x09fs exists: filename do: [:aBoolean |\x0a\x09\x09aBoolean\x0a\x09\x09\x09ifFalse: [self respondNotFoundTo: aResponse]\x0a\x09\x09\x09ifTrue: [self respondFileNamed: filename to: aResponse]]",
  340. messageSends: ["pathname", "parse:", "url", "join:with:", "basePath", "exists:do:", "ifFalse:ifTrue:", "respondNotFoundTo:", "respondFileNamed:to:"],
  341. referencedClasses: []
  342. }),
  343. smalltalk.FileServer);
  344. smalltalk.addMethod(
  345. smalltalk.method({
  346. selector: "handleOPTIONSRequest:respondTo:",
  347. category: 'request handling',
  348. fn: function (aRequest,aResponse){
  349. var self=this;
  350. return smalltalk.withContext(function($ctx1) {
  351. var $1,$3,$4,$5,$6,$7,$2;
  352. $1=aResponse;
  353. $3="Access-Control-Allow-Origin".__minus_gt("*");
  354. $ctx1.sendIdx["->"]=1;
  355. $4="Access-Control-Allow-Methods".__minus_gt("GET, PUT, POST, DELETE, OPTIONS");
  356. $ctx1.sendIdx["->"]=2;
  357. $5="Access-Control-Allow-Headers".__minus_gt("Content-Type, Accept");
  358. $ctx1.sendIdx["->"]=3;
  359. $6="Content-Length".__minus_gt((0));
  360. $ctx1.sendIdx["->"]=4;
  361. $7="Access-Control-Max-Age".__minus_gt((10));
  362. $2=smalltalk.HashedCollection._from_([$3,$4,$5,$6,$7]);
  363. _st($1)._writeHead_options_((200),$2);
  364. _st(aResponse)._end();
  365. return self}, function($ctx1) {$ctx1.fill(self,"handleOPTIONSRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  366. args: ["aRequest", "aResponse"],
  367. source: "handleOPTIONSRequest: aRequest respondTo: aResponse\x0a\x09aResponse writeHead: 200 options: #{'Access-Control-Allow-Origin' -> '*'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Methods' -> 'GET, PUT, POST, DELETE, OPTIONS'.\x0a\x09\x09\x09\x09\x09'Access-Control-Allow-Headers' -> 'Content-Type, Accept'.\x0a\x09\x09\x09\x09\x09'Content-Length' -> 0.\x0a\x09\x09\x09\x09\x09'Access-Control-Max-Age' -> 10}.\x0a\x09aResponse end",
  368. messageSends: ["writeHead:options:", "->", "end"],
  369. referencedClasses: []
  370. }),
  371. smalltalk.FileServer);
  372. smalltalk.addMethod(
  373. smalltalk.method({
  374. selector: "handlePUTRequest:respondTo:",
  375. category: 'request handling',
  376. fn: function (aRequest,aResponse){
  377. var self=this;
  378. var file,stream;
  379. return smalltalk.withContext(function($ctx1) {
  380. var $1,$3,$4,$5,$6,$2,$7,$8,$10,$9;
  381. $1=self._isAuthenticated_(aRequest);
  382. if(! smalltalk.assert($1)){
  383. self._respondAuthenticationRequiredTo_(aResponse);
  384. return nil;
  385. };
  386. file=".".__comma(_st(aRequest)._url());
  387. $ctx1.sendIdx[","]=1;
  388. stream=_st(self["@fs"])._createWriteStream_(file);
  389. $2=_st(stream)._on_do_("error",(function(error){
  390. return smalltalk.withContext(function($ctx2) {
  391. $3=console;
  392. $4="Error creating WriteStream for file ".__comma(file);
  393. $ctx2.sendIdx[","]=2;
  394. _st($3)._warn_($4);
  395. $ctx2.sendIdx["warn:"]=1;
  396. _st(console)._warn_(" Did you forget to create the necessary js/ or st/ directory in your project?");
  397. $ctx2.sendIdx["warn:"]=2;
  398. $5=console;
  399. $6=" The exact error is: ".__comma(error);
  400. _st($5)._warn_($6);
  401. return self._respondNotCreatedTo_(aResponse);
  402. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  403. $ctx1.sendIdx["on:do:"]=1;
  404. $7=_st(stream)._on_do_("close",(function(){
  405. return smalltalk.withContext(function($ctx2) {
  406. return self._respondCreatedTo_(aResponse);
  407. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  408. $ctx1.sendIdx["on:do:"]=2;
  409. _st(aRequest)._setEncoding_("utf8");
  410. $8=_st(aRequest)._on_do_("data",(function(data){
  411. return smalltalk.withContext(function($ctx2) {
  412. return _st(stream)._write_(data);
  413. }, function($ctx2) {$ctx2.fillBlock({data:data},$ctx1,4)})}));
  414. $ctx1.sendIdx["on:do:"]=3;
  415. $9=_st(aRequest)._on_do_("end",(function(){
  416. return smalltalk.withContext(function($ctx2) {
  417. $10=_st(stream)._writable();
  418. if(smalltalk.assert($10)){
  419. return _st(stream)._end();
  420. };
  421. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  422. return self}, function($ctx1) {$ctx1.fill(self,"handlePUTRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse,file:file,stream:stream},smalltalk.FileServer)})},
  423. args: ["aRequest", "aResponse"],
  424. source: "handlePUTRequest: aRequest respondTo: aResponse\x0a\x09| file stream |\x0a\x09(self isAuthenticated: aRequest)\x0a\x09\x09ifFalse: [self respondAuthenticationRequiredTo: aResponse. ^nil].\x0a\x0a\x09file := '.', aRequest url.\x0a\x09stream := fs createWriteStream: file.\x0a\x0a\x09stream on: 'error' do: [:error |\x0a\x09\x09console warn: 'Error creating WriteStream for file ', file.\x0a\x09\x09console warn: ' Did you forget to create the necessary js/ or st/ directory in your project?'.\x0a\x09\x09console warn: ' The exact error is: ', error.\x0a\x09\x09self respondNotCreatedTo: aResponse].\x0a\x0a\x09stream on: 'close' do: [\x0a\x09\x09self respondCreatedTo: aResponse].\x0a\x0a\x09aRequest setEncoding: 'utf8'.\x0a\x09aRequest on: 'data' do: [:data |\x0a\x09\x09stream write: data].\x0a\x0a\x09aRequest on: 'end' do: [\x0a\x09\x09stream writable ifTrue: [stream end]]",
  425. messageSends: ["ifFalse:", "isAuthenticated:", "respondAuthenticationRequiredTo:", ",", "url", "createWriteStream:", "on:do:", "warn:", "respondNotCreatedTo:", "respondCreatedTo:", "setEncoding:", "write:", "ifTrue:", "writable", "end"],
  426. referencedClasses: []
  427. }),
  428. smalltalk.FileServer);
  429. smalltalk.addMethod(
  430. smalltalk.method({
  431. selector: "handleRequest:respondTo:",
  432. category: 'request handling',
  433. fn: function (aRequest,aResponse){
  434. var self=this;
  435. return smalltalk.withContext(function($ctx1) {
  436. var $3,$2,$1,$6,$5,$4,$9,$8,$7;
  437. $3=_st(aRequest)._method();
  438. $ctx1.sendIdx["method"]=1;
  439. $2=_st($3).__eq("PUT");
  440. $ctx1.sendIdx["="]=1;
  441. if(smalltalk.assert($2)){
  442. $1=self._handlePUTRequest_respondTo_(aRequest,aResponse);
  443. };
  444. $6=_st(aRequest)._method();
  445. $ctx1.sendIdx["method"]=2;
  446. $5=_st($6).__eq("GET");
  447. $ctx1.sendIdx["="]=2;
  448. if(smalltalk.assert($5)){
  449. $4=self._handleGETRequest_respondTo_(aRequest,aResponse);
  450. };
  451. $9=_st(aRequest)._method();
  452. $8=_st($9).__eq("OPTIONS");
  453. if(smalltalk.assert($8)){
  454. $7=self._handleOPTIONSRequest_respondTo_(aRequest,aResponse);
  455. };
  456. return self}, function($ctx1) {$ctx1.fill(self,"handleRequest:respondTo:",{aRequest:aRequest,aResponse:aResponse},smalltalk.FileServer)})},
  457. args: ["aRequest", "aResponse"],
  458. source: "handleRequest: aRequest respondTo: aResponse\x0a\x09aRequest method = 'PUT'\x0a\x09\x09ifTrue: [self handlePUTRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'GET'\x0a\x09\x09ifTrue:[self handleGETRequest: aRequest respondTo: aResponse].\x0a\x09aRequest method = 'OPTIONS'\x0a\x09\x09ifTrue:[self handleOPTIONSRequest: aRequest respondTo: aResponse]",
  459. messageSends: ["ifTrue:", "=", "method", "handlePUTRequest:respondTo:", "handleGETRequest:respondTo:", "handleOPTIONSRequest:respondTo:"],
  460. referencedClasses: []
  461. }),
  462. smalltalk.FileServer);
  463. smalltalk.addMethod(
  464. smalltalk.method({
  465. selector: "host",
  466. category: 'accessing',
  467. fn: function (){
  468. var self=this;
  469. return smalltalk.withContext(function($ctx1) {
  470. var $1;
  471. $1=self["@host"];
  472. return $1;
  473. }, function($ctx1) {$ctx1.fill(self,"host",{},smalltalk.FileServer)})},
  474. args: [],
  475. source: "host\x0a\x09^host",
  476. messageSends: [],
  477. referencedClasses: []
  478. }),
  479. smalltalk.FileServer);
  480. smalltalk.addMethod(
  481. smalltalk.method({
  482. selector: "host:",
  483. category: 'accessing',
  484. fn: function (hostname){
  485. var self=this;
  486. return smalltalk.withContext(function($ctx1) {
  487. self["@host"]=hostname;
  488. return self}, function($ctx1) {$ctx1.fill(self,"host:",{hostname:hostname},smalltalk.FileServer)})},
  489. args: ["hostname"],
  490. source: "host: hostname\x0a\x09host := hostname",
  491. messageSends: [],
  492. referencedClasses: []
  493. }),
  494. smalltalk.FileServer);
  495. smalltalk.addMethod(
  496. smalltalk.method({
  497. selector: "initialize",
  498. category: 'initialization',
  499. fn: function (){
  500. var self=this;
  501. return smalltalk.withContext(function($ctx1) {
  502. var $1,$2;
  503. smalltalk.FileServer.superclass.fn.prototype._initialize.apply(_st(self), []);
  504. self["@path"]=self._require_("path");
  505. $ctx1.sendIdx["require:"]=1;
  506. self["@http"]=self._require_("http");
  507. $ctx1.sendIdx["require:"]=2;
  508. self["@fs"]=self._require_("fs");
  509. $ctx1.sendIdx["require:"]=3;
  510. self["@util"]=self._require_("util");
  511. $ctx1.sendIdx["require:"]=4;
  512. self["@url"]=self._require_("url");
  513. $1=self._class();
  514. $ctx1.sendIdx["class"]=1;
  515. self["@host"]=_st($1)._defaultHost();
  516. $2=self._class();
  517. self["@port"]=_st($2)._defaultPort();
  518. self["@username"]=nil;
  519. self["@password"]=nil;
  520. self["@fallbackPage"]=nil;
  521. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.FileServer)})},
  522. args: [],
  523. source: "initialize\x0a\x09super initialize.\x0a\x09path := self require: 'path'.\x0a\x09http := self require: 'http'.\x0a\x09fs := self require: 'fs'.\x0a\x09util := self require: 'util'.\x0a\x09url := self require: 'url'.\x0a\x09host := self class defaultHost.\x0a\x09port := self class defaultPort.\x0a\x09username := nil.\x0a\x09password := nil.\x0a\x09fallbackPage := nil.",
  524. messageSends: ["initialize", "require:", "defaultHost", "class", "defaultPort"],
  525. referencedClasses: []
  526. }),
  527. smalltalk.FileServer);
  528. smalltalk.addMethod(
  529. smalltalk.method({
  530. selector: "isAuthenticated:",
  531. category: 'private',
  532. fn: function (aRequest){
  533. var self=this;
  534. var header,token,auth,parts;
  535. return smalltalk.withContext(function($ctx1) {
  536. var $2,$1,$3,$5,$6,$7,$10,$11,$9,$12,$13,$8,$4;
  537. $2=_st(self["@username"])._isNil();
  538. $ctx1.sendIdx["isNil"]=1;
  539. $1=_st($2)._and_((function(){
  540. return smalltalk.withContext(function($ctx2) {
  541. return _st(self["@password"])._isNil();
  542. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  543. $ctx1.sendIdx["and:"]=1;
  544. if(smalltalk.assert($1)){
  545. return true;
  546. };
  547. $3=_st(_st(aRequest)._headers())._at_("authorization");
  548. $ctx1.sendIdx["at:"]=1;
  549. if(($receiver = $3) == nil || $receiver == null){
  550. header="";
  551. } else {
  552. header=$3;
  553. };
  554. $5=_st(header)._isEmpty();
  555. if(smalltalk.assert($5)){
  556. return false;
  557. } else {
  558. $6=_st(header)._tokenize_(" ");
  559. $ctx1.sendIdx["tokenize:"]=1;
  560. if(($receiver = $6) == nil || $receiver == null){
  561. token="";
  562. } else {
  563. token=$6;
  564. };
  565. token;
  566. $7=_st(token)._at_((2));
  567. $ctx1.sendIdx["at:"]=2;
  568. auth=self._base64Decode_($7);
  569. auth;
  570. parts=_st(auth)._tokenize_(":");
  571. parts;
  572. $10=self["@username"];
  573. $11=_st(parts)._at_((1));
  574. $ctx1.sendIdx["at:"]=3;
  575. $9=_st($10).__eq($11);
  576. $ctx1.sendIdx["="]=1;
  577. $8=_st($9)._and_((function(){
  578. return smalltalk.withContext(function($ctx2) {
  579. $12=self["@password"];
  580. $13=_st(parts)._at_((2));
  581. return _st($12).__eq($13);
  582. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,7)})}));
  583. if(smalltalk.assert($8)){
  584. return true;
  585. } else {
  586. return false;
  587. };
  588. };
  589. return self}, function($ctx1) {$ctx1.fill(self,"isAuthenticated:",{aRequest:aRequest,header:header,token:token,auth:auth,parts:parts},smalltalk.FileServer)})},
  590. args: ["aRequest"],
  591. source: "isAuthenticated: aRequest\x0a\x09\x22Basic HTTP Auth: http://stackoverflow.com/a/5957629/293175\x0a\x09 and https://gist.github.com/1686663\x22\x0a\x09| header token auth parts|\x0a\x0a\x09(username isNil and: [password isNil]) ifTrue: [^true].\x0a\x0a\x09\x22get authentication header\x22\x0a\x09header := (aRequest headers at: 'authorization') ifNil:[''].\x0a\x09(header isEmpty)\x0a\x09ifTrue: [^false]\x0a\x09ifFalse: [\x0a\x09\x09\x22get authentication token\x22\x0a\x09\x09token := (header tokenize: ' ') ifNil:[''].\x0a\x09\x09\x22convert back from base64\x22\x0a\x09\x09auth := self base64Decode: (token at: 2).\x0a\x09\x09\x22split token at colon\x22\x0a\x09\x09parts := auth tokenize: ':'.\x0a\x0a\x09\x09((username = (parts at: 1)) and: [password = (parts at: 2)])\x0a\x09\x09\x09ifTrue: [^true]\x0a\x09\x09\x09ifFalse: [^false]\x0a\x09].",
  592. messageSends: ["ifTrue:", "and:", "isNil", "ifNil:", "at:", "headers", "ifTrue:ifFalse:", "isEmpty", "tokenize:", "base64Decode:", "="],
  593. referencedClasses: []
  594. }),
  595. smalltalk.FileServer);
  596. smalltalk.addMethod(
  597. smalltalk.method({
  598. selector: "password:",
  599. category: 'accessing',
  600. fn: function (aPassword){
  601. var self=this;
  602. return smalltalk.withContext(function($ctx1) {
  603. self["@password"]=aPassword;
  604. return self}, function($ctx1) {$ctx1.fill(self,"password:",{aPassword:aPassword},smalltalk.FileServer)})},
  605. args: ["aPassword"],
  606. source: "password: aPassword\x0a\x09password := aPassword.",
  607. messageSends: [],
  608. referencedClasses: []
  609. }),
  610. smalltalk.FileServer);
  611. smalltalk.addMethod(
  612. smalltalk.method({
  613. selector: "port",
  614. category: 'accessing',
  615. fn: function (){
  616. var self=this;
  617. return smalltalk.withContext(function($ctx1) {
  618. var $1;
  619. $1=self["@port"];
  620. return $1;
  621. }, function($ctx1) {$ctx1.fill(self,"port",{},smalltalk.FileServer)})},
  622. args: [],
  623. source: "port\x0a\x09^port",
  624. messageSends: [],
  625. referencedClasses: []
  626. }),
  627. smalltalk.FileServer);
  628. smalltalk.addMethod(
  629. smalltalk.method({
  630. selector: "port:",
  631. category: 'accessing',
  632. fn: function (aNumber){
  633. var self=this;
  634. return smalltalk.withContext(function($ctx1) {
  635. self["@port"]=aNumber;
  636. return self}, function($ctx1) {$ctx1.fill(self,"port:",{aNumber:aNumber},smalltalk.FileServer)})},
  637. args: ["aNumber"],
  638. source: "port: aNumber\x0a\x09port := aNumber",
  639. messageSends: [],
  640. referencedClasses: []
  641. }),
  642. smalltalk.FileServer);
  643. smalltalk.addMethod(
  644. smalltalk.method({
  645. selector: "require:",
  646. category: 'private',
  647. fn: function (aModuleString){
  648. var self=this;
  649. return smalltalk.withContext(function($ctx1) {
  650. var $1;
  651. $1=_st(require)._value_(aModuleString);
  652. return $1;
  653. }, function($ctx1) {$ctx1.fill(self,"require:",{aModuleString:aModuleString},smalltalk.FileServer)})},
  654. args: ["aModuleString"],
  655. source: "require: aModuleString\x0a\x09\x22call to the require function\x22\x0a\x09^require value: aModuleString",
  656. messageSends: ["value:"],
  657. referencedClasses: []
  658. }),
  659. smalltalk.FileServer);
  660. smalltalk.addMethod(
  661. smalltalk.method({
  662. selector: "respondAuthenticationRequiredTo:",
  663. category: 'request handling',
  664. fn: function (aResponse){
  665. var self=this;
  666. return smalltalk.withContext(function($ctx1) {
  667. var $1,$2;
  668. $1=aResponse;
  669. _st($1)._writeHead_options_((401),smalltalk.HashedCollection._from_(["WWW-Authenticate".__minus_gt("Basic realm=\x22Secured Developer Area\x22")]));
  670. _st($1)._write_("<html><body>Authentication needed</body></html>");
  671. $2=_st($1)._end();
  672. return self}, function($ctx1) {$ctx1.fill(self,"respondAuthenticationRequiredTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  673. args: ["aResponse"],
  674. source: "respondAuthenticationRequiredTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 401 options: #{'WWW-Authenticate' -> 'Basic realm=\x22Secured Developer Area\x22'};\x0a\x09\x09write: '<html><body>Authentication needed</body></html>';\x0a\x09\x09end.",
  675. messageSends: ["writeHead:options:", "->", "write:", "end"],
  676. referencedClasses: []
  677. }),
  678. smalltalk.FileServer);
  679. smalltalk.addMethod(
  680. smalltalk.method({
  681. selector: "respondCreatedTo:",
  682. category: 'request handling',
  683. fn: function (aResponse){
  684. var self=this;
  685. return smalltalk.withContext(function($ctx1) {
  686. var $1,$2,$4,$5,$3,$6;
  687. $1=aResponse;
  688. $2=$1;
  689. $4="Content-Type".__minus_gt("text/plain");
  690. $ctx1.sendIdx["->"]=1;
  691. $5="Access-Control-Allow-Origin".__minus_gt("*");
  692. $3=smalltalk.HashedCollection._from_([$4,$5]);
  693. _st($2)._writeHead_options_((201),$3);
  694. $6=_st($1)._end();
  695. return self}, function($ctx1) {$ctx1.fill(self,"respondCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  696. args: ["aResponse"],
  697. source: "respondCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 201 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  698. messageSends: ["writeHead:options:", "->", "end"],
  699. referencedClasses: []
  700. }),
  701. smalltalk.FileServer);
  702. smalltalk.addMethod(
  703. smalltalk.method({
  704. selector: "respondFileNamed:to:",
  705. category: 'request handling',
  706. fn: function (aFilename,aResponse){
  707. var self=this;
  708. var type,filename;
  709. return smalltalk.withContext(function($ctx1) {
  710. var $2,$1,$3,$4,$5,$6,$7,$8;
  711. filename=aFilename;
  712. $2=_st(_st(self["@fs"])._statSync_(aFilename))._isDirectory();
  713. if(smalltalk.assert($2)){
  714. filename=_st(filename).__comma("index.html");
  715. $ctx1.sendIdx[","]=1;
  716. $1=filename;
  717. };
  718. _st(self["@fs"])._readFile_do_(filename,(function(ex,file){
  719. return smalltalk.withContext(function($ctx2) {
  720. $3=_st(ex)._notNil();
  721. if(smalltalk.assert($3)){
  722. $4=console;
  723. $5=_st(filename).__comma(" does not exist");
  724. $ctx2.sendIdx[","]=2;
  725. _st($4)._log_($5);
  726. return self._respondInternalErrorTo_(aResponse);
  727. } else {
  728. type=_st(self._class())._mimeTypeFor_(filename);
  729. type;
  730. $6=_st(type).__eq("application/javascript");
  731. if(smalltalk.assert($6)){
  732. type=_st(type).__comma(";charset=utf-8");
  733. type;
  734. };
  735. $7=aResponse;
  736. _st($7)._writeHead_options_((200),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt(type)]));
  737. _st($7)._write_encoding_(file,"binary");
  738. $8=_st($7)._end();
  739. return $8;
  740. };
  741. }, function($ctx2) {$ctx2.fillBlock({ex:ex,file:file},$ctx1,2)})}));
  742. return self}, function($ctx1) {$ctx1.fill(self,"respondFileNamed:to:",{aFilename:aFilename,aResponse:aResponse,type:type,filename:filename},smalltalk.FileServer)})},
  743. args: ["aFilename", "aResponse"],
  744. source: "respondFileNamed: aFilename to: aResponse\x0a\x09| type filename |\x0a\x0a\x09filename := aFilename.\x0a\x09(fs statSync: aFilename) isDirectory ifTrue: [\x0a\x09\x09filename := filename, 'index.html'].\x0a\x0a\x09fs readFile: filename do: [:ex :file |\x0a\x09\x09ex notNil \x0a\x09\x09\x09ifTrue: [\x0a\x09\x09\x09\x09console log: filename, ' does not exist'.\x0a\x09\x09\x09\x09self respondInternalErrorTo: aResponse]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09type := self class mimeTypeFor: filename.\x0a\x09\x09\x09\x09type = 'application/javascript'\x0a\x09\x09\x09\x09\x09ifTrue: [ type:=type,';charset=utf-8' ].\x0a\x09\x09\x09\x09aResponse \x0a\x09\x09\x09\x09\x09writeHead: 200 options: #{'Content-Type' -> type};\x0a\x09\x09\x09\x09\x09write: file encoding: 'binary';\x0a\x09\x09\x09\x09\x09end]]",
  745. messageSends: ["ifTrue:", "isDirectory", "statSync:", ",", "readFile:do:", "ifTrue:ifFalse:", "notNil", "log:", "respondInternalErrorTo:", "mimeTypeFor:", "class", "=", "writeHead:options:", "->", "write:encoding:", "end"],
  746. referencedClasses: []
  747. }),
  748. smalltalk.FileServer);
  749. smalltalk.addMethod(
  750. smalltalk.method({
  751. selector: "respondInternalErrorTo:",
  752. category: 'request handling',
  753. fn: function (aResponse){
  754. var self=this;
  755. return smalltalk.withContext(function($ctx1) {
  756. var $1,$2;
  757. $1=aResponse;
  758. _st($1)._writeHead_options_((500),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  759. _st($1)._write_("500 Internal server error");
  760. $2=_st($1)._end();
  761. return self}, function($ctx1) {$ctx1.fill(self,"respondInternalErrorTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  762. args: ["aResponse"],
  763. source: "respondInternalErrorTo: aResponse\x0a\x09aResponse \x0a\x09\x09writeHead: 500 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '500 Internal server error';\x0a\x09\x09end",
  764. messageSends: ["writeHead:options:", "->", "write:", "end"],
  765. referencedClasses: []
  766. }),
  767. smalltalk.FileServer);
  768. smalltalk.addMethod(
  769. smalltalk.method({
  770. selector: "respondNotCreatedTo:",
  771. category: 'request handling',
  772. fn: function (aResponse){
  773. var self=this;
  774. return smalltalk.withContext(function($ctx1) {
  775. var $1,$2;
  776. $1=aResponse;
  777. _st($1)._writeHead_options_((400),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  778. _st($1)._write_("File could not be created. Did you forget to create the st/js directories on the server?");
  779. $2=_st($1)._end();
  780. return self}, function($ctx1) {$ctx1.fill(self,"respondNotCreatedTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  781. args: ["aResponse"],
  782. source: "respondNotCreatedTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 400 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: 'File could not be created. Did you forget to create the st/js directories on the server?';\x0a\x09\x09end.",
  783. messageSends: ["writeHead:options:", "->", "write:", "end"],
  784. referencedClasses: []
  785. }),
  786. smalltalk.FileServer);
  787. smalltalk.addMethod(
  788. smalltalk.method({
  789. selector: "respondNotFoundTo:",
  790. category: 'request handling',
  791. fn: function (aResponse){
  792. var self=this;
  793. return smalltalk.withContext(function($ctx1) {
  794. var $2,$1,$4,$3,$5,$6;
  795. $2=self._fallbackPage();
  796. $ctx1.sendIdx["fallbackPage"]=1;
  797. $1=_st($2)._isNil();
  798. if(! smalltalk.assert($1)){
  799. $4=self._fallbackPage();
  800. $3=self._respondFileNamed_to_($4,aResponse);
  801. return $3;
  802. };
  803. $5=aResponse;
  804. _st($5)._writeHead_options_((404),smalltalk.HashedCollection._from_(["Content-Type".__minus_gt("text/plain")]));
  805. _st($5)._write_("404 Not found");
  806. $6=_st($5)._end();
  807. return self}, function($ctx1) {$ctx1.fill(self,"respondNotFoundTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  808. args: ["aResponse"],
  809. source: "respondNotFoundTo: aResponse\x0a\x09self fallbackPage isNil ifFalse: [^self respondFileNamed: self fallbackPage to: aResponse].\x0a\x09aResponse \x0a\x09\x09writeHead: 404 options: #{'Content-Type' -> 'text/plain'};\x0a\x09\x09write: '404 Not found';\x0a\x09\x09end",
  810. messageSends: ["ifFalse:", "isNil", "fallbackPage", "respondFileNamed:to:", "writeHead:options:", "->", "write:", "end"],
  811. referencedClasses: []
  812. }),
  813. smalltalk.FileServer);
  814. smalltalk.addMethod(
  815. smalltalk.method({
  816. selector: "respondOKTo:",
  817. category: 'request handling',
  818. fn: function (aResponse){
  819. var self=this;
  820. return smalltalk.withContext(function($ctx1) {
  821. var $1,$2,$4,$5,$3,$6;
  822. $1=aResponse;
  823. $2=$1;
  824. $4="Content-Type".__minus_gt("text/plain");
  825. $ctx1.sendIdx["->"]=1;
  826. $5="Access-Control-Allow-Origin".__minus_gt("*");
  827. $3=smalltalk.HashedCollection._from_([$4,$5]);
  828. _st($2)._writeHead_options_((200),$3);
  829. $6=_st($1)._end();
  830. return self}, function($ctx1) {$ctx1.fill(self,"respondOKTo:",{aResponse:aResponse},smalltalk.FileServer)})},
  831. args: ["aResponse"],
  832. source: "respondOKTo: aResponse\x0a\x09aResponse\x0a\x09\x09writeHead: 200 options: #{'Content-Type' -> 'text/plain'. 'Access-Control-Allow-Origin' -> '*'};\x0a\x09\x09end.",
  833. messageSends: ["writeHead:options:", "->", "end"],
  834. referencedClasses: []
  835. }),
  836. smalltalk.FileServer);
  837. smalltalk.addMethod(
  838. smalltalk.method({
  839. selector: "start",
  840. category: 'starting',
  841. fn: function (){
  842. var self=this;
  843. return smalltalk.withContext(function($ctx1) {
  844. var $1,$2,$3,$4,$8,$7,$6,$10,$9,$5,$12,$13,$14,$11;
  845. self._checkDirectoryLayout();
  846. $1=_st(self["@http"])._createServer_((function(request,response){
  847. return smalltalk.withContext(function($ctx2) {
  848. return self._handleRequest_respondTo_(request,response);
  849. }, function($ctx2) {$ctx2.fillBlock({request:request,response:response},$ctx1,1)})}));
  850. _st($1)._on_do_("error",(function(error){
  851. return smalltalk.withContext(function($ctx2) {
  852. $2=console;
  853. $3="Error starting server: ".__comma(error);
  854. $ctx2.sendIdx[","]=1;
  855. return _st($2)._log_($3);
  856. $ctx2.sendIdx["log:"]=1;
  857. }, function($ctx2) {$ctx2.fillBlock({error:error},$ctx1,2)})}));
  858. $ctx1.sendIdx["on:do:"]=1;
  859. _st($1)._on_do_("listening",(function(){
  860. return smalltalk.withContext(function($ctx2) {
  861. $4=console;
  862. $8=self._host();
  863. $ctx2.sendIdx["host"]=1;
  864. $7="Starting file server on http://".__comma($8);
  865. $6=_st($7).__comma(":");
  866. $ctx2.sendIdx[","]=3;
  867. $10=self._port();
  868. $ctx2.sendIdx["port"]=1;
  869. $9=_st($10)._asString();
  870. $5=_st($6).__comma($9);
  871. $ctx2.sendIdx[","]=2;
  872. return _st($4)._log_($5);
  873. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  874. $12=$1;
  875. $13=self._port();
  876. $14=self._host();
  877. $11=_st($12)._listen_host_($13,$14);
  878. return self}, function($ctx1) {$ctx1.fill(self,"start",{},smalltalk.FileServer)})},
  879. args: [],
  880. source: "start\x0a\x09\x22Checks if required directory layout is present (issue warning if not).\x0a\x09 Afterwards start the server.\x22\x0a\x09self checkDirectoryLayout.\x0a\x09(http createServer: [:request :response |\x0a\x09 self handleRequest: request respondTo: response])\x0a\x09 on: 'error' do: [:error | console log: 'Error starting server: ', error];\x0a\x09 on: 'listening' do: [console log: 'Starting file server on http://', self host, ':', self port asString];\x0a\x09 listen: self port host: self host.",
  881. messageSends: ["checkDirectoryLayout", "on:do:", "createServer:", "handleRequest:respondTo:", "log:", ",", "host", "asString", "port", "listen:host:"],
  882. referencedClasses: []
  883. }),
  884. smalltalk.FileServer);
  885. smalltalk.addMethod(
  886. smalltalk.method({
  887. selector: "startOn:",
  888. category: 'starting',
  889. fn: function (aPort){
  890. var self=this;
  891. return smalltalk.withContext(function($ctx1) {
  892. self._port_(aPort);
  893. self._start();
  894. return self}, function($ctx1) {$ctx1.fill(self,"startOn:",{aPort:aPort},smalltalk.FileServer)})},
  895. args: ["aPort"],
  896. source: "startOn: aPort\x0a\x09self port: aPort.\x0a\x09self start",
  897. messageSends: ["port:", "start"],
  898. referencedClasses: []
  899. }),
  900. smalltalk.FileServer);
  901. smalltalk.addMethod(
  902. smalltalk.method({
  903. selector: "username:",
  904. category: 'accessing',
  905. fn: function (aUsername){
  906. var self=this;
  907. return smalltalk.withContext(function($ctx1) {
  908. self["@username"]=aUsername;
  909. return self}, function($ctx1) {$ctx1.fill(self,"username:",{aUsername:aUsername},smalltalk.FileServer)})},
  910. args: ["aUsername"],
  911. source: "username: aUsername\x0a\x09username := aUsername.",
  912. messageSends: [],
  913. referencedClasses: []
  914. }),
  915. smalltalk.FileServer);
  916. smalltalk.addMethod(
  917. smalltalk.method({
  918. selector: "writeData:toFileNamed:",
  919. category: 'private',
  920. fn: function (data,aFilename){
  921. var self=this;
  922. return smalltalk.withContext(function($ctx1) {
  923. _st(console)._log_(aFilename);
  924. return self}, function($ctx1) {$ctx1.fill(self,"writeData:toFileNamed:",{data:data,aFilename:aFilename},smalltalk.FileServer)})},
  925. args: ["data", "aFilename"],
  926. source: "writeData: data toFileNamed: aFilename\x0a\x09console log: aFilename",
  927. messageSends: ["log:"],
  928. referencedClasses: []
  929. }),
  930. smalltalk.FileServer);
  931. smalltalk.FileServer.klass.iVarNames = ['mimeTypes'];
  932. smalltalk.addMethod(
  933. smalltalk.method({
  934. selector: "commandLineSwitches",
  935. category: 'accessing',
  936. fn: function (){
  937. var self=this;
  938. var switches;
  939. return smalltalk.withContext(function($ctx1) {
  940. var $2,$1,$3;
  941. switches=_st(self._methodsInProtocol_("accessing"))._collect_((function(each){
  942. return smalltalk.withContext(function($ctx2) {
  943. return _st(each)._selector();
  944. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  945. $ctx1.sendIdx["collect:"]=1;
  946. switches=_st(switches)._select_((function(each){
  947. return smalltalk.withContext(function($ctx2) {
  948. return _st(each)._match_("^[^:]*:$");
  949. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,2)})}));
  950. switches=_st(switches)._collect_((function(each){
  951. return smalltalk.withContext(function($ctx2) {
  952. $2=_st(_st(each)._allButLast())._replace_with_("([A-Z])","-$1");
  953. $1=_st($2)._asLowercase();
  954. return _st($1)._replace_with_("^([a-z])","--$1");
  955. $ctx2.sendIdx["replace:with:"]=1;
  956. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,3)})}));
  957. $3=switches;
  958. return $3;
  959. }, function($ctx1) {$ctx1.fill(self,"commandLineSwitches",{switches:switches},smalltalk.FileServer.klass)})},
  960. args: [],
  961. source: "commandLineSwitches\x0a\x09\x22Collect all methodnames from the 'accessing' protocol\x0a\x09 and select the ones with only one parameter.\x0a\x09 Then remove the ':' at the end of the name\x0a\x09 and add a '--' at the beginning.\x0a\x09 Additionally all uppercase letters are made lowercase and preceded by a '-'.\x0a\x09 Example: fallbackPage: becomes --fallback-page.\x0a\x09 Return the Array containing the commandline switches.\x22\x0a\x09| switches |\x0a\x09switches := ((self methodsInProtocol: 'accessing') collect: [ :each | each selector]).\x0a\x09switches := switches select: [ :each | each match: '^[^:]*:$'].\x0a\x09switches :=switches collect: [ :each |\x0a\x09\x09(each allButLast replace: '([A-Z])' with: '-$1') asLowercase replace: '^([a-z])' with: '--$1' ].\x0a\x09^switches",
  962. messageSends: ["collect:", "methodsInProtocol:", "selector", "select:", "match:", "replace:with:", "asLowercase", "allButLast"],
  963. referencedClasses: []
  964. }),
  965. smalltalk.FileServer.klass);
  966. smalltalk.addMethod(
  967. smalltalk.method({
  968. selector: "createServerWithArguments:",
  969. category: 'initialization',
  970. fn: function (options){
  971. var self=this;
  972. var server,popFront,front,optionName,optionValue,switches;
  973. function $Array(){return smalltalk.Array||(typeof Array=="undefined"?nil:Array)}
  974. return smalltalk.withContext(function($ctx1) {
  975. var $1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13;
  976. var $early={};
  977. try {
  978. switches=self._commandLineSwitches();
  979. server=self._new();
  980. _st(options)._ifEmpty_((function(){
  981. return smalltalk.withContext(function($ctx2) {
  982. $1=server;
  983. throw $early=[$1];
  984. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  985. $2=_st(_st(options)._size())._even();
  986. if(! smalltalk.assert($2)){
  987. _st(console)._log_("Using default parameters.");
  988. $ctx1.sendIdx["log:"]=1;
  989. $3=console;
  990. $4="Wrong commandline options or not enough arguments for: ".__comma(options);
  991. $ctx1.sendIdx[","]=1;
  992. _st($3)._log_($4);
  993. $ctx1.sendIdx["log:"]=2;
  994. $5=console;
  995. $6="Use any of the following ones: ".__comma(switches);
  996. $ctx1.sendIdx[","]=2;
  997. _st($5)._log_($6);
  998. $ctx1.sendIdx["log:"]=3;
  999. $7=server;
  1000. return $7;
  1001. };
  1002. popFront=(function(args){
  1003. return smalltalk.withContext(function($ctx2) {
  1004. front=_st(args)._first();
  1005. front;
  1006. _st(args)._remove_(front);
  1007. return front;
  1008. }, function($ctx2) {$ctx2.fillBlock({args:args},$ctx1,3)})});
  1009. _st((function(){
  1010. return smalltalk.withContext(function($ctx2) {
  1011. return _st(options)._notEmpty();
  1012. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,4)})}))._whileTrue_((function(){
  1013. return smalltalk.withContext(function($ctx2) {
  1014. optionName=_st(popFront)._value_(options);
  1015. $ctx2.sendIdx["value:"]=1;
  1016. optionName;
  1017. optionValue=_st(popFront)._value_(options);
  1018. optionValue;
  1019. $8=_st(switches)._includes_(optionName);
  1020. if(smalltalk.assert($8)){
  1021. optionName=self._selectorForCommandLineSwitch_(optionName);
  1022. optionName;
  1023. return _st(server)._perform_withArguments_(optionName,_st($Array())._with_(optionValue));
  1024. } else {
  1025. $9=console;
  1026. $10=_st(optionName).__comma(" is not a valid commandline option");
  1027. $ctx2.sendIdx[","]=3;
  1028. _st($9)._log_($10);
  1029. $ctx2.sendIdx["log:"]=4;
  1030. $11=console;
  1031. $12="Use any of the following ones: ".__comma(switches);
  1032. return _st($11)._log_($12);
  1033. };
  1034. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,5)})}));
  1035. $13=server;
  1036. return $13;
  1037. }
  1038. catch(e) {if(e===$early)return e[0]; throw e}
  1039. }, function($ctx1) {$ctx1.fill(self,"createServerWithArguments:",{options:options,server:server,popFront:popFront,front:front,optionName:optionName,optionValue:optionValue,switches:switches},smalltalk.FileServer.klass)})},
  1040. args: ["options"],
  1041. source: "createServerWithArguments: options\x0a\x09\x22If options are empty return a default FileServer instance.\x0a\x09 If options are given loop through them and set the passed in values\x0a\x09 on the FileServer instance.\x0a\x09 \x0a\x09 Commanline options map directly to methods in the 'accessing' protocol\x0a\x09 taking one parameter.\x0a\x09 Adding a method to this protocol makes it directly settable through\x0a\x09 command line options.\x0a\x09 \x22\x0a\x09| server popFront front optionName optionValue switches |\x0a\x0a\x09switches := self commandLineSwitches.\x0a\x0a\x09server := self new.\x0a\x0a\x09options ifEmpty: [^server].\x0a\x0a\x09(options size even) ifFalse: [\x0a\x09\x09console log: 'Using default parameters.'.\x0a\x09\x09console log: 'Wrong commandline options or not enough arguments for: ' , options.\x0a\x09\x09console log: 'Use any of the following ones: ', switches.\x0a\x09\x09^server].\x0a\x0a\x09popFront := [:args |\x0a\x09\x09front := args first.\x0a\x09\x09args remove: front.\x0a\x09\x09front].\x0a\x0a\x09[options notEmpty] whileTrue: [\x0a\x09\x09optionName := popFront value: options.\x0a\x09\x09optionValue := popFront value: options.\x0a\x0a\x09\x09(switches includes: optionName) ifTrue: [\x0a\x09\x09\x09optionName := self selectorForCommandLineSwitch: optionName.\x0a\x09\x09\x09server perform: optionName withArguments: (Array with: optionValue)]\x0a\x09\x09\x09ifFalse: [\x0a\x09\x09\x09\x09console log: optionName, ' is not a valid commandline option'.\x0a\x09\x09\x09\x09console log: 'Use any of the following ones: ', switches ]].\x0a\x09^server.",
  1042. messageSends: ["commandLineSwitches", "new", "ifEmpty:", "ifFalse:", "even", "size", "log:", ",", "first", "remove:", "whileTrue:", "notEmpty", "value:", "ifTrue:ifFalse:", "includes:", "selectorForCommandLineSwitch:", "perform:withArguments:", "with:"],
  1043. referencedClasses: ["Array"]
  1044. }),
  1045. smalltalk.FileServer.klass);
  1046. smalltalk.addMethod(
  1047. smalltalk.method({
  1048. selector: "defaultHost",
  1049. category: 'accessing',
  1050. fn: function (){
  1051. var self=this;
  1052. return smalltalk.withContext(function($ctx1) {
  1053. return "127.0.0.1";
  1054. }, function($ctx1) {$ctx1.fill(self,"defaultHost",{},smalltalk.FileServer.klass)})},
  1055. args: [],
  1056. source: "defaultHost\x0a\x09^'127.0.0.1'",
  1057. messageSends: [],
  1058. referencedClasses: []
  1059. }),
  1060. smalltalk.FileServer.klass);
  1061. smalltalk.addMethod(
  1062. smalltalk.method({
  1063. selector: "defaultMimeTypes",
  1064. category: 'accessing',
  1065. fn: function (){
  1066. var self=this;
  1067. return smalltalk.withContext(function($ctx1) {
  1068. var $2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410,$1;
  1069. $2="%".__minus_gt("application/x-trash");
  1070. $ctx1.sendIdx["->"]=1;
  1071. $3="323".__minus_gt("text/h323");
  1072. $ctx1.sendIdx["->"]=2;
  1073. $4="abw".__minus_gt("application/x-abiword");
  1074. $ctx1.sendIdx["->"]=3;
  1075. $5="ai".__minus_gt("application/postscript");
  1076. $ctx1.sendIdx["->"]=4;
  1077. $6="aif".__minus_gt("audio/x-aiff");
  1078. $ctx1.sendIdx["->"]=5;
  1079. $7="aifc".__minus_gt("audio/x-aiff");
  1080. $ctx1.sendIdx["->"]=6;
  1081. $8="aiff".__minus_gt("audio/x-aiff");
  1082. $ctx1.sendIdx["->"]=7;
  1083. $9="alc".__minus_gt("chemical/x-alchemy");
  1084. $ctx1.sendIdx["->"]=8;
  1085. $10="art".__minus_gt("image/x-jg");
  1086. $ctx1.sendIdx["->"]=9;
  1087. $11="asc".__minus_gt("text/plain");
  1088. $ctx1.sendIdx["->"]=10;
  1089. $12="asf".__minus_gt("video/x-ms-asf");
  1090. $ctx1.sendIdx["->"]=11;
  1091. $13="asn".__minus_gt("chemical/x-ncbi-asn1-spec");
  1092. $ctx1.sendIdx["->"]=12;
  1093. $14="aso".__minus_gt("chemical/x-ncbi-asn1-binary");
  1094. $ctx1.sendIdx["->"]=13;
  1095. $15="asx".__minus_gt("video/x-ms-asf");
  1096. $ctx1.sendIdx["->"]=14;
  1097. $16="au".__minus_gt("audio/basic");
  1098. $ctx1.sendIdx["->"]=15;
  1099. $17="avi".__minus_gt("video/x-msvideo");
  1100. $ctx1.sendIdx["->"]=16;
  1101. $18="b".__minus_gt("chemical/x-molconn-Z");
  1102. $ctx1.sendIdx["->"]=17;
  1103. $19="bak".__minus_gt("application/x-trash");
  1104. $ctx1.sendIdx["->"]=18;
  1105. $20="bat".__minus_gt("application/x-msdos-program");
  1106. $ctx1.sendIdx["->"]=19;
  1107. $21="bcpio".__minus_gt("application/x-bcpio");
  1108. $ctx1.sendIdx["->"]=20;
  1109. $22="bib".__minus_gt("text/x-bibtex");
  1110. $ctx1.sendIdx["->"]=21;
  1111. $23="bin".__minus_gt("application/octet-stream");
  1112. $ctx1.sendIdx["->"]=22;
  1113. $24="bmp".__minus_gt("image/x-ms-bmp");
  1114. $ctx1.sendIdx["->"]=23;
  1115. $25="book".__minus_gt("application/x-maker");
  1116. $ctx1.sendIdx["->"]=24;
  1117. $26="bsd".__minus_gt("chemical/x-crossfire");
  1118. $ctx1.sendIdx["->"]=25;
  1119. $27="c".__minus_gt("text/x-csrc");
  1120. $ctx1.sendIdx["->"]=26;
  1121. $28="c++".__minus_gt("text/x-c++src");
  1122. $ctx1.sendIdx["->"]=27;
  1123. $29="c3d".__minus_gt("chemical/x-chem3d");
  1124. $ctx1.sendIdx["->"]=28;
  1125. $30="cac".__minus_gt("chemical/x-cache");
  1126. $ctx1.sendIdx["->"]=29;
  1127. $31="cache".__minus_gt("chemical/x-cache");
  1128. $ctx1.sendIdx["->"]=30;
  1129. $32="cascii".__minus_gt("chemical/x-cactvs-binary");
  1130. $ctx1.sendIdx["->"]=31;
  1131. $33="cat".__minus_gt("application/vnd.ms-pki.seccat");
  1132. $ctx1.sendIdx["->"]=32;
  1133. $34="cbin".__minus_gt("chemical/x-cactvs-binary");
  1134. $ctx1.sendIdx["->"]=33;
  1135. $35="cc".__minus_gt("text/x-c++src");
  1136. $ctx1.sendIdx["->"]=34;
  1137. $36="cdf".__minus_gt("application/x-cdf");
  1138. $ctx1.sendIdx["->"]=35;
  1139. $37="cdr".__minus_gt("image/x-coreldraw");
  1140. $ctx1.sendIdx["->"]=36;
  1141. $38="cdt".__minus_gt("image/x-coreldrawtemplate");
  1142. $ctx1.sendIdx["->"]=37;
  1143. $39="cdx".__minus_gt("chemical/x-cdx");
  1144. $ctx1.sendIdx["->"]=38;
  1145. $40="cdy".__minus_gt("application/vnd.cinderella");
  1146. $ctx1.sendIdx["->"]=39;
  1147. $41="cef".__minus_gt("chemical/x-cxf");
  1148. $ctx1.sendIdx["->"]=40;
  1149. $42="cer".__minus_gt("chemical/x-cerius");
  1150. $ctx1.sendIdx["->"]=41;
  1151. $43="chm".__minus_gt("chemical/x-chemdraw");
  1152. $ctx1.sendIdx["->"]=42;
  1153. $44="chrt".__minus_gt("application/x-kchart");
  1154. $ctx1.sendIdx["->"]=43;
  1155. $45="cif".__minus_gt("chemical/x-cif");
  1156. $ctx1.sendIdx["->"]=44;
  1157. $46="class".__minus_gt("application/java-vm");
  1158. $ctx1.sendIdx["->"]=45;
  1159. $47="cls".__minus_gt("text/x-tex");
  1160. $ctx1.sendIdx["->"]=46;
  1161. $48="cmdf".__minus_gt("chemical/x-cmdf");
  1162. $ctx1.sendIdx["->"]=47;
  1163. $49="cml".__minus_gt("chemical/x-cml");
  1164. $ctx1.sendIdx["->"]=48;
  1165. $50="cod".__minus_gt("application/vnd.rim.cod");
  1166. $ctx1.sendIdx["->"]=49;
  1167. $51="com".__minus_gt("application/x-msdos-program");
  1168. $ctx1.sendIdx["->"]=50;
  1169. $52="cpa".__minus_gt("chemical/x-compass");
  1170. $ctx1.sendIdx["->"]=51;
  1171. $53="cpio".__minus_gt("application/x-cpio");
  1172. $ctx1.sendIdx["->"]=52;
  1173. $54="cpp".__minus_gt("text/x-c++src");
  1174. $ctx1.sendIdx["->"]=53;
  1175. $55="cpt".__minus_gt("image/x-corelphotopaint");
  1176. $ctx1.sendIdx["->"]=54;
  1177. $56="crl".__minus_gt("application/x-pkcs7-crl");
  1178. $ctx1.sendIdx["->"]=55;
  1179. $57="crt".__minus_gt("application/x-x509-ca-cert");
  1180. $ctx1.sendIdx["->"]=56;
  1181. $58="csf".__minus_gt("chemical/x-cache-csf");
  1182. $ctx1.sendIdx["->"]=57;
  1183. $59="csh".__minus_gt("text/x-csh");
  1184. $ctx1.sendIdx["->"]=58;
  1185. $60="csm".__minus_gt("chemical/x-csml");
  1186. $ctx1.sendIdx["->"]=59;
  1187. $61="csml".__minus_gt("chemical/x-csml");
  1188. $ctx1.sendIdx["->"]=60;
  1189. $62="css".__minus_gt("text/css");
  1190. $ctx1.sendIdx["->"]=61;
  1191. $63="csv".__minus_gt("text/comma-separated-values");
  1192. $ctx1.sendIdx["->"]=62;
  1193. $64="ctab".__minus_gt("chemical/x-cactvs-binary");
  1194. $ctx1.sendIdx["->"]=63;
  1195. $65="ctx".__minus_gt("chemical/x-ctx");
  1196. $ctx1.sendIdx["->"]=64;
  1197. $66="cu".__minus_gt("application/cu-seeme");
  1198. $ctx1.sendIdx["->"]=65;
  1199. $67="cub".__minus_gt("chemical/x-gaussian-cube");
  1200. $ctx1.sendIdx["->"]=66;
  1201. $68="cxf".__minus_gt("chemical/x-cxf");
  1202. $ctx1.sendIdx["->"]=67;
  1203. $69="cxx".__minus_gt("text/x-c++src");
  1204. $ctx1.sendIdx["->"]=68;
  1205. $70="dat".__minus_gt("chemical/x-mopac-input");
  1206. $ctx1.sendIdx["->"]=69;
  1207. $71="dcr".__minus_gt("application/x-director");
  1208. $ctx1.sendIdx["->"]=70;
  1209. $72="deb".__minus_gt("application/x-debian-package");
  1210. $ctx1.sendIdx["->"]=71;
  1211. $73="dif".__minus_gt("video/dv");
  1212. $ctx1.sendIdx["->"]=72;
  1213. $74="diff".__minus_gt("text/plain");
  1214. $ctx1.sendIdx["->"]=73;
  1215. $75="dir".__minus_gt("application/x-director");
  1216. $ctx1.sendIdx["->"]=74;
  1217. $76="djv".__minus_gt("image/vnd.djvu");
  1218. $ctx1.sendIdx["->"]=75;
  1219. $77="djvu".__minus_gt("image/vnd.djvu");
  1220. $ctx1.sendIdx["->"]=76;
  1221. $78="dl".__minus_gt("video/dl");
  1222. $ctx1.sendIdx["->"]=77;
  1223. $79="dll".__minus_gt("application/x-msdos-program");
  1224. $ctx1.sendIdx["->"]=78;
  1225. $80="dmg".__minus_gt("application/x-apple-diskimage");
  1226. $ctx1.sendIdx["->"]=79;
  1227. $81="dms".__minus_gt("application/x-dms");
  1228. $ctx1.sendIdx["->"]=80;
  1229. $82="doc".__minus_gt("application/msword");
  1230. $ctx1.sendIdx["->"]=81;
  1231. $83="dot".__minus_gt("application/msword");
  1232. $ctx1.sendIdx["->"]=82;
  1233. $84="dv".__minus_gt("video/dv");
  1234. $ctx1.sendIdx["->"]=83;
  1235. $85="dvi".__minus_gt("application/x-dvi");
  1236. $ctx1.sendIdx["->"]=84;
  1237. $86="dx".__minus_gt("chemical/x-jcamp-dx");
  1238. $ctx1.sendIdx["->"]=85;
  1239. $87="dxr".__minus_gt("application/x-director");
  1240. $ctx1.sendIdx["->"]=86;
  1241. $88="emb".__minus_gt("chemical/x-embl-dl-nucleotide");
  1242. $ctx1.sendIdx["->"]=87;
  1243. $89="embl".__minus_gt("chemical/x-embl-dl-nucleotide");
  1244. $ctx1.sendIdx["->"]=88;
  1245. $90="ent".__minus_gt("chemical/x-pdb");
  1246. $ctx1.sendIdx["->"]=89;
  1247. $91="eps".__minus_gt("application/postscript");
  1248. $ctx1.sendIdx["->"]=90;
  1249. $92="etx".__minus_gt("text/x-setext");
  1250. $ctx1.sendIdx["->"]=91;
  1251. $93="exe".__minus_gt("application/x-msdos-program");
  1252. $ctx1.sendIdx["->"]=92;
  1253. $94="ez".__minus_gt("application/andrew-inset");
  1254. $ctx1.sendIdx["->"]=93;
  1255. $95="fb".__minus_gt("application/x-maker");
  1256. $ctx1.sendIdx["->"]=94;
  1257. $96="fbdoc".__minus_gt("application/x-maker");
  1258. $ctx1.sendIdx["->"]=95;
  1259. $97="fch".__minus_gt("chemical/x-gaussian-checkpoint");
  1260. $ctx1.sendIdx["->"]=96;
  1261. $98="fchk".__minus_gt("chemical/x-gaussian-checkpoint");
  1262. $ctx1.sendIdx["->"]=97;
  1263. $99="fig".__minus_gt("application/x-xfig");
  1264. $ctx1.sendIdx["->"]=98;
  1265. $100="flac".__minus_gt("application/x-flac");
  1266. $ctx1.sendIdx["->"]=99;
  1267. $101="fli".__minus_gt("video/fli");
  1268. $ctx1.sendIdx["->"]=100;
  1269. $102="fm".__minus_gt("application/x-maker");
  1270. $ctx1.sendIdx["->"]=101;
  1271. $103="frame".__minus_gt("application/x-maker");
  1272. $ctx1.sendIdx["->"]=102;
  1273. $104="frm".__minus_gt("application/x-maker");
  1274. $ctx1.sendIdx["->"]=103;
  1275. $105="gal".__minus_gt("chemical/x-gaussian-log");
  1276. $ctx1.sendIdx["->"]=104;
  1277. $106="gam".__minus_gt("chemical/x-gamess-input");
  1278. $ctx1.sendIdx["->"]=105;
  1279. $107="gamin".__minus_gt("chemical/x-gamess-input");
  1280. $ctx1.sendIdx["->"]=106;
  1281. $108="gau".__minus_gt("chemical/x-gaussian-input");
  1282. $ctx1.sendIdx["->"]=107;
  1283. $109="gcd".__minus_gt("text/x-pcs-gcd");
  1284. $ctx1.sendIdx["->"]=108;
  1285. $110="gcf".__minus_gt("application/x-graphing-calculator");
  1286. $ctx1.sendIdx["->"]=109;
  1287. $111="gcg".__minus_gt("chemical/x-gcg8-sequence");
  1288. $ctx1.sendIdx["->"]=110;
  1289. $112="gen".__minus_gt("chemical/x-genbank");
  1290. $ctx1.sendIdx["->"]=111;
  1291. $113="gf".__minus_gt("application/x-tex-gf");
  1292. $ctx1.sendIdx["->"]=112;
  1293. $114="gif".__minus_gt("image/gif");
  1294. $ctx1.sendIdx["->"]=113;
  1295. $115="gjc".__minus_gt("chemical/x-gaussian-input");
  1296. $ctx1.sendIdx["->"]=114;
  1297. $116="gjf".__minus_gt("chemical/x-gaussian-input");
  1298. $ctx1.sendIdx["->"]=115;
  1299. $117="gl".__minus_gt("video/gl");
  1300. $ctx1.sendIdx["->"]=116;
  1301. $118="gnumeric".__minus_gt("application/x-gnumeric");
  1302. $ctx1.sendIdx["->"]=117;
  1303. $119="gpt".__minus_gt("chemical/x-mopac-graph");
  1304. $ctx1.sendIdx["->"]=118;
  1305. $120="gsf".__minus_gt("application/x-font");
  1306. $ctx1.sendIdx["->"]=119;
  1307. $121="gsm".__minus_gt("audio/x-gsm");
  1308. $ctx1.sendIdx["->"]=120;
  1309. $122="gtar".__minus_gt("application/x-gtar");
  1310. $ctx1.sendIdx["->"]=121;
  1311. $123="h".__minus_gt("text/x-chdr");
  1312. $ctx1.sendIdx["->"]=122;
  1313. $124="h++".__minus_gt("text/x-c++hdr");
  1314. $ctx1.sendIdx["->"]=123;
  1315. $125="hdf".__minus_gt("application/x-hdf");
  1316. $ctx1.sendIdx["->"]=124;
  1317. $126="hh".__minus_gt("text/x-c++hdr");
  1318. $ctx1.sendIdx["->"]=125;
  1319. $127="hin".__minus_gt("chemical/x-hin");
  1320. $ctx1.sendIdx["->"]=126;
  1321. $128="hpp".__minus_gt("text/x-c++hdr");
  1322. $ctx1.sendIdx["->"]=127;
  1323. $129="hqx".__minus_gt("application/mac-binhex40");
  1324. $ctx1.sendIdx["->"]=128;
  1325. $130="hs".__minus_gt("text/x-haskell");
  1326. $ctx1.sendIdx["->"]=129;
  1327. $131="hta".__minus_gt("application/hta");
  1328. $ctx1.sendIdx["->"]=130;
  1329. $132="htc".__minus_gt("text/x-component");
  1330. $ctx1.sendIdx["->"]=131;
  1331. $133="htm".__minus_gt("text/html");
  1332. $ctx1.sendIdx["->"]=132;
  1333. $134="html".__minus_gt("text/html");
  1334. $ctx1.sendIdx["->"]=133;
  1335. $135="hxx".__minus_gt("text/x-c++hdr");
  1336. $ctx1.sendIdx["->"]=134;
  1337. $136="ica".__minus_gt("application/x-ica");
  1338. $ctx1.sendIdx["->"]=135;
  1339. $137="ice".__minus_gt("x-conference/x-cooltalk");
  1340. $ctx1.sendIdx["->"]=136;
  1341. $138="ico".__minus_gt("image/x-icon");
  1342. $ctx1.sendIdx["->"]=137;
  1343. $139="ics".__minus_gt("text/calendar");
  1344. $ctx1.sendIdx["->"]=138;
  1345. $140="icz".__minus_gt("text/calendar");
  1346. $ctx1.sendIdx["->"]=139;
  1347. $141="ief".__minus_gt("image/ief");
  1348. $ctx1.sendIdx["->"]=140;
  1349. $142="iges".__minus_gt("model/iges");
  1350. $ctx1.sendIdx["->"]=141;
  1351. $143="igs".__minus_gt("model/iges");
  1352. $ctx1.sendIdx["->"]=142;
  1353. $144="iii".__minus_gt("application/x-iphone");
  1354. $ctx1.sendIdx["->"]=143;
  1355. $145="inp".__minus_gt("chemical/x-gamess-input");
  1356. $ctx1.sendIdx["->"]=144;
  1357. $146="ins".__minus_gt("application/x-internet-signup");
  1358. $ctx1.sendIdx["->"]=145;
  1359. $147="iso".__minus_gt("application/x-iso9660-image");
  1360. $ctx1.sendIdx["->"]=146;
  1361. $148="isp".__minus_gt("application/x-internet-signup");
  1362. $ctx1.sendIdx["->"]=147;
  1363. $149="ist".__minus_gt("chemical/x-isostar");
  1364. $ctx1.sendIdx["->"]=148;
  1365. $150="istr".__minus_gt("chemical/x-isostar");
  1366. $ctx1.sendIdx["->"]=149;
  1367. $151="jad".__minus_gt("text/vnd.sun.j2me.app-descriptor");
  1368. $ctx1.sendIdx["->"]=150;
  1369. $152="jar".__minus_gt("application/java-archive");
  1370. $ctx1.sendIdx["->"]=151;
  1371. $153="java".__minus_gt("text/x-java");
  1372. $ctx1.sendIdx["->"]=152;
  1373. $154="jdx".__minus_gt("chemical/x-jcamp-dx");
  1374. $ctx1.sendIdx["->"]=153;
  1375. $155="jmz".__minus_gt("application/x-jmol");
  1376. $ctx1.sendIdx["->"]=154;
  1377. $156="jng".__minus_gt("image/x-jng");
  1378. $ctx1.sendIdx["->"]=155;
  1379. $157="jnlp".__minus_gt("application/x-java-jnlp-file");
  1380. $ctx1.sendIdx["->"]=156;
  1381. $158="jpe".__minus_gt("image/jpeg");
  1382. $ctx1.sendIdx["->"]=157;
  1383. $159="jpeg".__minus_gt("image/jpeg");
  1384. $ctx1.sendIdx["->"]=158;
  1385. $160="jpg".__minus_gt("image/jpeg");
  1386. $ctx1.sendIdx["->"]=159;
  1387. $161="js".__minus_gt("application/javascript");
  1388. $ctx1.sendIdx["->"]=160;
  1389. $162="kar".__minus_gt("audio/midi");
  1390. $ctx1.sendIdx["->"]=161;
  1391. $163="key".__minus_gt("application/pgp-keys");
  1392. $ctx1.sendIdx["->"]=162;
  1393. $164="kil".__minus_gt("application/x-killustrator");
  1394. $ctx1.sendIdx["->"]=163;
  1395. $165="kin".__minus_gt("chemical/x-kinemage");
  1396. $ctx1.sendIdx["->"]=164;
  1397. $166="kpr".__minus_gt("application/x-kpresenter");
  1398. $ctx1.sendIdx["->"]=165;
  1399. $167="kpt".__minus_gt("application/x-kpresenter");
  1400. $ctx1.sendIdx["->"]=166;
  1401. $168="ksp".__minus_gt("application/x-kspread");
  1402. $ctx1.sendIdx["->"]=167;
  1403. $169="kwd".__minus_gt("application/x-kword");
  1404. $ctx1.sendIdx["->"]=168;
  1405. $170="kwt".__minus_gt("application/x-kword");
  1406. $ctx1.sendIdx["->"]=169;
  1407. $171="latex".__minus_gt("application/x-latex");
  1408. $ctx1.sendIdx["->"]=170;
  1409. $172="lha".__minus_gt("application/x-lha");
  1410. $ctx1.sendIdx["->"]=171;
  1411. $173="lhs".__minus_gt("text/x-literate-haskell");
  1412. $ctx1.sendIdx["->"]=172;
  1413. $174="lsf".__minus_gt("video/x-la-asf");
  1414. $ctx1.sendIdx["->"]=173;
  1415. $175="lsx".__minus_gt("video/x-la-asf");
  1416. $ctx1.sendIdx["->"]=174;
  1417. $176="ltx".__minus_gt("text/x-tex");
  1418. $ctx1.sendIdx["->"]=175;
  1419. $177="lzh".__minus_gt("application/x-lzh");
  1420. $ctx1.sendIdx["->"]=176;
  1421. $178="lzx".__minus_gt("application/x-lzx");
  1422. $ctx1.sendIdx["->"]=177;
  1423. $179="m3u".__minus_gt("audio/x-mpegurl");
  1424. $ctx1.sendIdx["->"]=178;
  1425. $180="m4a".__minus_gt("audio/mpeg");
  1426. $ctx1.sendIdx["->"]=179;
  1427. $181="maker".__minus_gt("application/x-maker");
  1428. $ctx1.sendIdx["->"]=180;
  1429. $182="man".__minus_gt("application/x-troff-man");
  1430. $ctx1.sendIdx["->"]=181;
  1431. $183="mcif".__minus_gt("chemical/x-mmcif");
  1432. $ctx1.sendIdx["->"]=182;
  1433. $184="mcm".__minus_gt("chemical/x-macmolecule");
  1434. $ctx1.sendIdx["->"]=183;
  1435. $185="mdb".__minus_gt("application/msaccess");
  1436. $ctx1.sendIdx["->"]=184;
  1437. $186="me".__minus_gt("application/x-troff-me");
  1438. $ctx1.sendIdx["->"]=185;
  1439. $187="mesh".__minus_gt("model/mesh");
  1440. $ctx1.sendIdx["->"]=186;
  1441. $188="mid".__minus_gt("audio/midi");
  1442. $ctx1.sendIdx["->"]=187;
  1443. $189="midi".__minus_gt("audio/midi");
  1444. $ctx1.sendIdx["->"]=188;
  1445. $190="mif".__minus_gt("application/x-mif");
  1446. $ctx1.sendIdx["->"]=189;
  1447. $191="mm".__minus_gt("application/x-freemind");
  1448. $ctx1.sendIdx["->"]=190;
  1449. $192="mmd".__minus_gt("chemical/x-macromodel-input");
  1450. $ctx1.sendIdx["->"]=191;
  1451. $193="mmf".__minus_gt("application/vnd.smaf");
  1452. $ctx1.sendIdx["->"]=192;
  1453. $194="mml".__minus_gt("text/mathml");
  1454. $ctx1.sendIdx["->"]=193;
  1455. $195="mmod".__minus_gt("chemical/x-macromodel-input");
  1456. $ctx1.sendIdx["->"]=194;
  1457. $196="mng".__minus_gt("video/x-mng");
  1458. $ctx1.sendIdx["->"]=195;
  1459. $197="moc".__minus_gt("text/x-moc");
  1460. $ctx1.sendIdx["->"]=196;
  1461. $198="mol".__minus_gt("chemical/x-mdl-molfile");
  1462. $ctx1.sendIdx["->"]=197;
  1463. $199="mol2".__minus_gt("chemical/x-mol2");
  1464. $ctx1.sendIdx["->"]=198;
  1465. $200="moo".__minus_gt("chemical/x-mopac-out");
  1466. $ctx1.sendIdx["->"]=199;
  1467. $201="mop".__minus_gt("chemical/x-mopac-input");
  1468. $ctx1.sendIdx["->"]=200;
  1469. $202="mopcrt".__minus_gt("chemical/x-mopac-input");
  1470. $ctx1.sendIdx["->"]=201;
  1471. $203="mov".__minus_gt("video/quicktime");
  1472. $ctx1.sendIdx["->"]=202;
  1473. $204="movie".__minus_gt("video/x-sgi-movie");
  1474. $ctx1.sendIdx["->"]=203;
  1475. $205="mp2".__minus_gt("audio/mpeg");
  1476. $ctx1.sendIdx["->"]=204;
  1477. $206="mp3".__minus_gt("audio/mpeg");
  1478. $ctx1.sendIdx["->"]=205;
  1479. $207="mp4".__minus_gt("video/mp4");
  1480. $ctx1.sendIdx["->"]=206;
  1481. $208="mpc".__minus_gt("chemical/x-mopac-input");
  1482. $ctx1.sendIdx["->"]=207;
  1483. $209="mpe".__minus_gt("video/mpeg");
  1484. $ctx1.sendIdx["->"]=208;
  1485. $210="mpeg".__minus_gt("video/mpeg");
  1486. $ctx1.sendIdx["->"]=209;
  1487. $211="mpega".__minus_gt("audio/mpeg");
  1488. $ctx1.sendIdx["->"]=210;
  1489. $212="mpg".__minus_gt("video/mpeg");
  1490. $ctx1.sendIdx["->"]=211;
  1491. $213="mpga".__minus_gt("audio/mpeg");
  1492. $ctx1.sendIdx["->"]=212;
  1493. $214="ms".__minus_gt("application/x-troff-ms");
  1494. $ctx1.sendIdx["->"]=213;
  1495. $215="msh".__minus_gt("model/mesh");
  1496. $ctx1.sendIdx["->"]=214;
  1497. $216="msi".__minus_gt("application/x-msi");
  1498. $ctx1.sendIdx["->"]=215;
  1499. $217="mvb".__minus_gt("chemical/x-mopac-vib");
  1500. $ctx1.sendIdx["->"]=216;
  1501. $218="mxu".__minus_gt("video/vnd.mpegurl");
  1502. $ctx1.sendIdx["->"]=217;
  1503. $219="nb".__minus_gt("application/mathematica");
  1504. $ctx1.sendIdx["->"]=218;
  1505. $220="nc".__minus_gt("application/x-netcdf");
  1506. $ctx1.sendIdx["->"]=219;
  1507. $221="nwc".__minus_gt("application/x-nwc");
  1508. $ctx1.sendIdx["->"]=220;
  1509. $222="o".__minus_gt("application/x-object");
  1510. $ctx1.sendIdx["->"]=221;
  1511. $223="oda".__minus_gt("application/oda");
  1512. $ctx1.sendIdx["->"]=222;
  1513. $224="odb".__minus_gt("application/vnd.oasis.opendocument.database");
  1514. $ctx1.sendIdx["->"]=223;
  1515. $225="odc".__minus_gt("application/vnd.oasis.opendocument.chart");
  1516. $ctx1.sendIdx["->"]=224;
  1517. $226="odf".__minus_gt("application/vnd.oasis.opendocument.formula");
  1518. $ctx1.sendIdx["->"]=225;
  1519. $227="odg".__minus_gt("application/vnd.oasis.opendocument.graphics");
  1520. $ctx1.sendIdx["->"]=226;
  1521. $228="odi".__minus_gt("application/vnd.oasis.opendocument.image");
  1522. $ctx1.sendIdx["->"]=227;
  1523. $229="odm".__minus_gt("application/vnd.oasis.opendocument.text-master");
  1524. $ctx1.sendIdx["->"]=228;
  1525. $230="odp".__minus_gt("application/vnd.oasis.opendocument.presentation");
  1526. $ctx1.sendIdx["->"]=229;
  1527. $231="ods".__minus_gt("application/vnd.oasis.opendocument.spreadsheet");
  1528. $ctx1.sendIdx["->"]=230;
  1529. $232="odt".__minus_gt("application/vnd.oasis.opendocument.text");
  1530. $ctx1.sendIdx["->"]=231;
  1531. $233="ogg".__minus_gt("application/ogg");
  1532. $ctx1.sendIdx["->"]=232;
  1533. $234="old".__minus_gt("application/x-trash");
  1534. $ctx1.sendIdx["->"]=233;
  1535. $235="oth".__minus_gt("application/vnd.oasis.opendocument.text-web");
  1536. $ctx1.sendIdx["->"]=234;
  1537. $236="oza".__minus_gt("application/x-oz-application");
  1538. $ctx1.sendIdx["->"]=235;
  1539. $237="p".__minus_gt("text/x-pascal");
  1540. $ctx1.sendIdx["->"]=236;
  1541. $238="p7r".__minus_gt("application/x-pkcs7-certreqresp");
  1542. $ctx1.sendIdx["->"]=237;
  1543. $239="pac".__minus_gt("application/x-ns-proxy-autoconfig");
  1544. $ctx1.sendIdx["->"]=238;
  1545. $240="pas".__minus_gt("text/x-pascal");
  1546. $ctx1.sendIdx["->"]=239;
  1547. $241="pat".__minus_gt("image/x-coreldrawpattern");
  1548. $ctx1.sendIdx["->"]=240;
  1549. $242="pbm".__minus_gt("image/x-portable-bitmap");
  1550. $ctx1.sendIdx["->"]=241;
  1551. $243="pcf".__minus_gt("application/x-font");
  1552. $ctx1.sendIdx["->"]=242;
  1553. $244="pcf.Z".__minus_gt("application/x-font");
  1554. $ctx1.sendIdx["->"]=243;
  1555. $245="pcx".__minus_gt("image/pcx");
  1556. $ctx1.sendIdx["->"]=244;
  1557. $246="pdb".__minus_gt("chemical/x-pdb");
  1558. $ctx1.sendIdx["->"]=245;
  1559. $247="pdf".__minus_gt("application/pdf");
  1560. $ctx1.sendIdx["->"]=246;
  1561. $248="pfa".__minus_gt("application/x-font");
  1562. $ctx1.sendIdx["->"]=247;
  1563. $249="pfb".__minus_gt("application/x-font");
  1564. $ctx1.sendIdx["->"]=248;
  1565. $250="pgm".__minus_gt("image/x-portable-graymap");
  1566. $ctx1.sendIdx["->"]=249;
  1567. $251="pgn".__minus_gt("application/x-chess-pgn");
  1568. $ctx1.sendIdx["->"]=250;
  1569. $252="pgp".__minus_gt("application/pgp-signature");
  1570. $ctx1.sendIdx["->"]=251;
  1571. $253="pk".__minus_gt("application/x-tex-pk");
  1572. $ctx1.sendIdx["->"]=252;
  1573. $254="pl".__minus_gt("text/x-perl");
  1574. $ctx1.sendIdx["->"]=253;
  1575. $255="pls".__minus_gt("audio/x-scpls");
  1576. $ctx1.sendIdx["->"]=254;
  1577. $256="pm".__minus_gt("text/x-perl");
  1578. $ctx1.sendIdx["->"]=255;
  1579. $257="png".__minus_gt("image/png");
  1580. $ctx1.sendIdx["->"]=256;
  1581. $258="pnm".__minus_gt("image/x-portable-anymap");
  1582. $ctx1.sendIdx["->"]=257;
  1583. $259="pot".__minus_gt("text/plain");
  1584. $ctx1.sendIdx["->"]=258;
  1585. $260="ppm".__minus_gt("image/x-portable-pixmap");
  1586. $ctx1.sendIdx["->"]=259;
  1587. $261="pps".__minus_gt("application/vnd.ms-powerpoint");
  1588. $ctx1.sendIdx["->"]=260;
  1589. $262="ppt".__minus_gt("application/vnd.ms-powerpoint");
  1590. $ctx1.sendIdx["->"]=261;
  1591. $263="prf".__minus_gt("application/pics-rules");
  1592. $ctx1.sendIdx["->"]=262;
  1593. $264="prt".__minus_gt("chemical/x-ncbi-asn1-ascii");
  1594. $ctx1.sendIdx["->"]=263;
  1595. $265="ps".__minus_gt("application/postscript");
  1596. $ctx1.sendIdx["->"]=264;
  1597. $266="psd".__minus_gt("image/x-photoshop");
  1598. $ctx1.sendIdx["->"]=265;
  1599. $267="psp".__minus_gt("text/x-psp");
  1600. $ctx1.sendIdx["->"]=266;
  1601. $268="py".__minus_gt("text/x-python");
  1602. $ctx1.sendIdx["->"]=267;
  1603. $269="pyc".__minus_gt("application/x-python-code");
  1604. $ctx1.sendIdx["->"]=268;
  1605. $270="pyo".__minus_gt("application/x-python-code");
  1606. $ctx1.sendIdx["->"]=269;
  1607. $271="qt".__minus_gt("video/quicktime");
  1608. $ctx1.sendIdx["->"]=270;
  1609. $272="qtl".__minus_gt("application/x-quicktimeplayer");
  1610. $ctx1.sendIdx["->"]=271;
  1611. $273="ra".__minus_gt("audio/x-realaudio");
  1612. $ctx1.sendIdx["->"]=272;
  1613. $274="ram".__minus_gt("audio/x-pn-realaudio");
  1614. $ctx1.sendIdx["->"]=273;
  1615. $275="rar".__minus_gt("application/rar");
  1616. $ctx1.sendIdx["->"]=274;
  1617. $276="ras".__minus_gt("image/x-cmu-raster");
  1618. $ctx1.sendIdx["->"]=275;
  1619. $277="rd".__minus_gt("chemical/x-mdl-rdfile");
  1620. $ctx1.sendIdx["->"]=276;
  1621. $278="rdf".__minus_gt("application/rdf+xml");
  1622. $ctx1.sendIdx["->"]=277;
  1623. $279="rgb".__minus_gt("image/x-rgb");
  1624. $ctx1.sendIdx["->"]=278;
  1625. $280="rm".__minus_gt("audio/x-pn-realaudio");
  1626. $ctx1.sendIdx["->"]=279;
  1627. $281="roff".__minus_gt("application/x-troff");
  1628. $ctx1.sendIdx["->"]=280;
  1629. $282="ros".__minus_gt("chemical/x-rosdal");
  1630. $ctx1.sendIdx["->"]=281;
  1631. $283="rpm".__minus_gt("application/x-redhat-package-manager");
  1632. $ctx1.sendIdx["->"]=282;
  1633. $284="rss".__minus_gt("application/rss+xml");
  1634. $ctx1.sendIdx["->"]=283;
  1635. $285="rtf".__minus_gt("text/rtf");
  1636. $ctx1.sendIdx["->"]=284;
  1637. $286="rtx".__minus_gt("text/richtext");
  1638. $ctx1.sendIdx["->"]=285;
  1639. $287="rxn".__minus_gt("chemical/x-mdl-rxnfile");
  1640. $ctx1.sendIdx["->"]=286;
  1641. $288="sct".__minus_gt("text/scriptlet");
  1642. $ctx1.sendIdx["->"]=287;
  1643. $289="sd".__minus_gt("chemical/x-mdl-sdfile");
  1644. $ctx1.sendIdx["->"]=288;
  1645. $290="sd2".__minus_gt("audio/x-sd2");
  1646. $ctx1.sendIdx["->"]=289;
  1647. $291="sda".__minus_gt("application/vnd.stardivision.draw");
  1648. $ctx1.sendIdx["->"]=290;
  1649. $292="sdc".__minus_gt("application/vnd.stardivision.calc");
  1650. $ctx1.sendIdx["->"]=291;
  1651. $293="sdd".__minus_gt("application/vnd.stardivision.impress");
  1652. $ctx1.sendIdx["->"]=292;
  1653. $294="sdf".__minus_gt("chemical/x-mdl-sdfile");
  1654. $ctx1.sendIdx["->"]=293;
  1655. $295="sdp".__minus_gt("application/vnd.stardivision.impress");
  1656. $ctx1.sendIdx["->"]=294;
  1657. $296="sdw".__minus_gt("application/vnd.stardivision.writer");
  1658. $ctx1.sendIdx["->"]=295;
  1659. $297="ser".__minus_gt("application/java-serialized-object");
  1660. $ctx1.sendIdx["->"]=296;
  1661. $298="sgf".__minus_gt("application/x-go-sgf");
  1662. $ctx1.sendIdx["->"]=297;
  1663. $299="sgl".__minus_gt("application/vnd.stardivision.writer-global");
  1664. $ctx1.sendIdx["->"]=298;
  1665. $300="sh".__minus_gt("text/x-sh");
  1666. $ctx1.sendIdx["->"]=299;
  1667. $301="shar".__minus_gt("application/x-shar");
  1668. $ctx1.sendIdx["->"]=300;
  1669. $302="shtml".__minus_gt("text/html");
  1670. $ctx1.sendIdx["->"]=301;
  1671. $303="sid".__minus_gt("audio/prs.sid");
  1672. $ctx1.sendIdx["->"]=302;
  1673. $304="sik".__minus_gt("application/x-trash");
  1674. $ctx1.sendIdx["->"]=303;
  1675. $305="silo".__minus_gt("model/mesh");
  1676. $ctx1.sendIdx["->"]=304;
  1677. $306="sis".__minus_gt("application/vnd.symbian.install");
  1678. $ctx1.sendIdx["->"]=305;
  1679. $307="sit".__minus_gt("application/x-stuffit");
  1680. $ctx1.sendIdx["->"]=306;
  1681. $308="skd".__minus_gt("application/x-koan");
  1682. $ctx1.sendIdx["->"]=307;
  1683. $309="skm".__minus_gt("application/x-koan");
  1684. $ctx1.sendIdx["->"]=308;
  1685. $310="skp".__minus_gt("application/x-koan");
  1686. $ctx1.sendIdx["->"]=309;
  1687. $311="skt".__minus_gt("application/x-koan");
  1688. $ctx1.sendIdx["->"]=310;
  1689. $312="smf".__minus_gt("application/vnd.stardivision.math");
  1690. $ctx1.sendIdx["->"]=311;
  1691. $313="smi".__minus_gt("application/smil");
  1692. $ctx1.sendIdx["->"]=312;
  1693. $314="smil".__minus_gt("application/smil");
  1694. $ctx1.sendIdx["->"]=313;
  1695. $315="snd".__minus_gt("audio/basic");
  1696. $ctx1.sendIdx["->"]=314;
  1697. $316="spc".__minus_gt("chemical/x-galactic-spc");
  1698. $ctx1.sendIdx["->"]=315;
  1699. $317="spl".__minus_gt("application/x-futuresplash");
  1700. $ctx1.sendIdx["->"]=316;
  1701. $318="src".__minus_gt("application/x-wais-source");
  1702. $ctx1.sendIdx["->"]=317;
  1703. $319="stc".__minus_gt("application/vnd.sun.xml.calc.template");
  1704. $ctx1.sendIdx["->"]=318;
  1705. $320="std".__minus_gt("application/vnd.sun.xml.draw.template");
  1706. $ctx1.sendIdx["->"]=319;
  1707. $321="sti".__minus_gt("application/vnd.sun.xml.impress.template");
  1708. $ctx1.sendIdx["->"]=320;
  1709. $322="stl".__minus_gt("application/vnd.ms-pki.stl");
  1710. $ctx1.sendIdx["->"]=321;
  1711. $323="stw".__minus_gt("application/vnd.sun.xml.writer.template");
  1712. $ctx1.sendIdx["->"]=322;
  1713. $324="sty".__minus_gt("text/x-tex");
  1714. $ctx1.sendIdx["->"]=323;
  1715. $325="sv4cpio".__minus_gt("application/x-sv4cpio");
  1716. $ctx1.sendIdx["->"]=324;
  1717. $326="sv4crc".__minus_gt("application/x-sv4crc");
  1718. $ctx1.sendIdx["->"]=325;
  1719. $327="svg".__minus_gt("image/svg+xml");
  1720. $ctx1.sendIdx["->"]=326;
  1721. $328="svgz".__minus_gt("image/svg+xml");
  1722. $ctx1.sendIdx["->"]=327;
  1723. $329="sw".__minus_gt("chemical/x-swissprot");
  1724. $ctx1.sendIdx["->"]=328;
  1725. $330="swf".__minus_gt("application/x-shockwave-flash");
  1726. $ctx1.sendIdx["->"]=329;
  1727. $331="swfl".__minus_gt("application/x-shockwave-flash");
  1728. $ctx1.sendIdx["->"]=330;
  1729. $332="sxc".__minus_gt("application/vnd.sun.xml.calc");
  1730. $ctx1.sendIdx["->"]=331;
  1731. $333="sxd".__minus_gt("application/vnd.sun.xml.draw");
  1732. $ctx1.sendIdx["->"]=332;
  1733. $334="sxg".__minus_gt("application/vnd.sun.xml.writer.global");
  1734. $ctx1.sendIdx["->"]=333;
  1735. $335="sxi".__minus_gt("application/vnd.sun.xml.impress");
  1736. $ctx1.sendIdx["->"]=334;
  1737. $336="sxm".__minus_gt("application/vnd.sun.xml.math");
  1738. $ctx1.sendIdx["->"]=335;
  1739. $337="sxw".__minus_gt("application/vnd.sun.xml.writer");
  1740. $ctx1.sendIdx["->"]=336;
  1741. $338="t".__minus_gt("application/x-troff");
  1742. $ctx1.sendIdx["->"]=337;
  1743. $339="tar".__minus_gt("application/x-tar");
  1744. $ctx1.sendIdx["->"]=338;
  1745. $340="taz".__minus_gt("application/x-gtar");
  1746. $ctx1.sendIdx["->"]=339;
  1747. $341="tcl".__minus_gt("text/x-tcl");
  1748. $ctx1.sendIdx["->"]=340;
  1749. $342="tex".__minus_gt("text/x-tex");
  1750. $ctx1.sendIdx["->"]=341;
  1751. $343="texi".__minus_gt("application/x-texinfo");
  1752. $ctx1.sendIdx["->"]=342;
  1753. $344="texinfo".__minus_gt("application/x-texinfo");
  1754. $ctx1.sendIdx["->"]=343;
  1755. $345="text".__minus_gt("text/plain");
  1756. $ctx1.sendIdx["->"]=344;
  1757. $346="tgf".__minus_gt("chemical/x-mdl-tgf");
  1758. $ctx1.sendIdx["->"]=345;
  1759. $347="tgz".__minus_gt("application/x-gtar");
  1760. $ctx1.sendIdx["->"]=346;
  1761. $348="tif".__minus_gt("image/tiff");
  1762. $ctx1.sendIdx["->"]=347;
  1763. $349="tiff".__minus_gt("image/tiff");
  1764. $ctx1.sendIdx["->"]=348;
  1765. $350="tk".__minus_gt("text/x-tcl");
  1766. $ctx1.sendIdx["->"]=349;
  1767. $351="tm".__minus_gt("text/texmacs");
  1768. $ctx1.sendIdx["->"]=350;
  1769. $352="torrent".__minus_gt("application/x-bittorrent");
  1770. $ctx1.sendIdx["->"]=351;
  1771. $353="tr".__minus_gt("application/x-troff");
  1772. $ctx1.sendIdx["->"]=352;
  1773. $354="ts".__minus_gt("text/texmacs");
  1774. $ctx1.sendIdx["->"]=353;
  1775. $355="tsp".__minus_gt("application/dsptype");
  1776. $ctx1.sendIdx["->"]=354;
  1777. $356="tsv".__minus_gt("text/tab-separated-values");
  1778. $ctx1.sendIdx["->"]=355;
  1779. $357="txt".__minus_gt("text/plain");
  1780. $ctx1.sendIdx["->"]=356;
  1781. $358="udeb".__minus_gt("application/x-debian-package");
  1782. $ctx1.sendIdx["->"]=357;
  1783. $359="uls".__minus_gt("text/iuls");
  1784. $ctx1.sendIdx["->"]=358;
  1785. $360="ustar".__minus_gt("application/x-ustar");
  1786. $ctx1.sendIdx["->"]=359;
  1787. $361="val".__minus_gt("chemical/x-ncbi-asn1-binary");
  1788. $ctx1.sendIdx["->"]=360;
  1789. $362="vcd".__minus_gt("application/x-cdlink");
  1790. $ctx1.sendIdx["->"]=361;
  1791. $363="vcf".__minus_gt("text/x-vcard");
  1792. $ctx1.sendIdx["->"]=362;
  1793. $364="vcs".__minus_gt("text/x-vcalendar");
  1794. $ctx1.sendIdx["->"]=363;
  1795. $365="vmd".__minus_gt("chemical/x-vmd");
  1796. $ctx1.sendIdx["->"]=364;
  1797. $366="vms".__minus_gt("chemical/x-vamas-iso14976");
  1798. $ctx1.sendIdx["->"]=365;
  1799. $367="vor".__minus_gt("application/vnd.stardivision.writer");
  1800. $ctx1.sendIdx["->"]=366;
  1801. $368="vrm".__minus_gt("x-world/x-vrml");
  1802. $ctx1.sendIdx["->"]=367;
  1803. $369="vrml".__minus_gt("x-world/x-vrml");
  1804. $ctx1.sendIdx["->"]=368;
  1805. $370="vsd".__minus_gt("application/vnd.visio");
  1806. $ctx1.sendIdx["->"]=369;
  1807. $371="wad".__minus_gt("application/x-doom");
  1808. $ctx1.sendIdx["->"]=370;
  1809. $372="wav".__minus_gt("audio/x-wav");
  1810. $ctx1.sendIdx["->"]=371;
  1811. $373="wax".__minus_gt("audio/x-ms-wax");
  1812. $ctx1.sendIdx["->"]=372;
  1813. $374="wbmp".__minus_gt("image/vnd.wap.wbmp");
  1814. $ctx1.sendIdx["->"]=373;
  1815. $375="wbxml".__minus_gt("application/vnd.wap.wbxml");
  1816. $ctx1.sendIdx["->"]=374;
  1817. $376="wk".__minus_gt("application/x-123");
  1818. $ctx1.sendIdx["->"]=375;
  1819. $377="wm".__minus_gt("video/x-ms-wm");
  1820. $ctx1.sendIdx["->"]=376;
  1821. $378="wma".__minus_gt("audio/x-ms-wma");
  1822. $ctx1.sendIdx["->"]=377;
  1823. $379="wmd".__minus_gt("application/x-ms-wmd");
  1824. $ctx1.sendIdx["->"]=378;
  1825. $380="wml".__minus_gt("text/vnd.wap.wml");
  1826. $ctx1.sendIdx["->"]=379;
  1827. $381="wmlc".__minus_gt("application/vnd.wap.wmlc");
  1828. $ctx1.sendIdx["->"]=380;
  1829. $382="wmls".__minus_gt("text/vnd.wap.wmlscript");
  1830. $ctx1.sendIdx["->"]=381;
  1831. $383="wmlsc".__minus_gt("application/vnd.wap.wmlscriptc");
  1832. $ctx1.sendIdx["->"]=382;
  1833. $384="wmv".__minus_gt("video/x-ms-wmv");
  1834. $ctx1.sendIdx["->"]=383;
  1835. $385="wmx".__minus_gt("video/x-ms-wmx");
  1836. $ctx1.sendIdx["->"]=384;
  1837. $386="wmz".__minus_gt("application/x-ms-wmz");
  1838. $ctx1.sendIdx["->"]=385;
  1839. $387="wp5".__minus_gt("application/wordperfect5.1");
  1840. $ctx1.sendIdx["->"]=386;
  1841. $388="wpd".__minus_gt("application/wordperfect");
  1842. $ctx1.sendIdx["->"]=387;
  1843. $389="wrl".__minus_gt("x-world/x-vrml");
  1844. $ctx1.sendIdx["->"]=388;
  1845. $390="wsc".__minus_gt("text/scriptlet");
  1846. $ctx1.sendIdx["->"]=389;
  1847. $391="wvx".__minus_gt("video/x-ms-wvx");
  1848. $ctx1.sendIdx["->"]=390;
  1849. $392="wz".__minus_gt("application/x-wingz");
  1850. $ctx1.sendIdx["->"]=391;
  1851. $393="xbm".__minus_gt("image/x-xbitmap");
  1852. $ctx1.sendIdx["->"]=392;
  1853. $394="xcf".__minus_gt("application/x-xcf");
  1854. $ctx1.sendIdx["->"]=393;
  1855. $395="xht".__minus_gt("application/xhtml+xml");
  1856. $ctx1.sendIdx["->"]=394;
  1857. $396="xhtml".__minus_gt("application/xhtml+xml");
  1858. $ctx1.sendIdx["->"]=395;
  1859. $397="xlb".__minus_gt("application/vnd.ms-excel");
  1860. $ctx1.sendIdx["->"]=396;
  1861. $398="xls".__minus_gt("application/vnd.ms-excel");
  1862. $ctx1.sendIdx["->"]=397;
  1863. $399="xlt".__minus_gt("application/vnd.ms-excel");
  1864. $ctx1.sendIdx["->"]=398;
  1865. $400="xml".__minus_gt("application/xml");
  1866. $ctx1.sendIdx["->"]=399;
  1867. $401="xpi".__minus_gt("application/x-xpinstall");
  1868. $ctx1.sendIdx["->"]=400;
  1869. $402="xpm".__minus_gt("image/x-xpixmap");
  1870. $ctx1.sendIdx["->"]=401;
  1871. $403="xsl".__minus_gt("application/xml");
  1872. $ctx1.sendIdx["->"]=402;
  1873. $404="xtel".__minus_gt("chemical/x-xtel");
  1874. $ctx1.sendIdx["->"]=403;
  1875. $405="xul".__minus_gt("application/vnd.mozilla.xul+xml");
  1876. $ctx1.sendIdx["->"]=404;
  1877. $406="xwd".__minus_gt("image/x-xwindowdump");
  1878. $ctx1.sendIdx["->"]=405;
  1879. $407="xyz".__minus_gt("chemical/x-xyz");
  1880. $ctx1.sendIdx["->"]=406;
  1881. $408="zip".__minus_gt("application/zip");
  1882. $ctx1.sendIdx["->"]=407;
  1883. $409="zmt".__minus_gt("chemical/x-mopac-input");
  1884. $ctx1.sendIdx["->"]=408;
  1885. $410="~".__minus_gt("application/x-trash");
  1886. $1=smalltalk.HashedCollection._from_([$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21,$22,$23,$24,$25,$26,$27,$28,$29,$30,$31,$32,$33,$34,$35,$36,$37,$38,$39,$40,$41,$42,$43,$44,$45,$46,$47,$48,$49,$50,$51,$52,$53,$54,$55,$56,$57,$58,$59,$60,$61,$62,$63,$64,$65,$66,$67,$68,$69,$70,$71,$72,$73,$74,$75,$76,$77,$78,$79,$80,$81,$82,$83,$84,$85,$86,$87,$88,$89,$90,$91,$92,$93,$94,$95,$96,$97,$98,$99,$100,$101,$102,$103,$104,$105,$106,$107,$108,$109,$110,$111,$112,$113,$114,$115,$116,$117,$118,$119,$120,$121,$122,$123,$124,$125,$126,$127,$128,$129,$130,$131,$132,$133,$134,$135,$136,$137,$138,$139,$140,$141,$142,$143,$144,$145,$146,$147,$148,$149,$150,$151,$152,$153,$154,$155,$156,$157,$158,$159,$160,$161,$162,$163,$164,$165,$166,$167,$168,$169,$170,$171,$172,$173,$174,$175,$176,$177,$178,$179,$180,$181,$182,$183,$184,$185,$186,$187,$188,$189,$190,$191,$192,$193,$194,$195,$196,$197,$198,$199,$200,$201,$202,$203,$204,$205,$206,$207,$208,$209,$210,$211,$212,$213,$214,$215,$216,$217,$218,$219,$220,$221,$222,$223,$224,$225,$226,$227,$228,$229,$230,$231,$232,$233,$234,$235,$236,$237,$238,$239,$240,$241,$242,$243,$244,$245,$246,$247,$248,$249,$250,$251,$252,$253,$254,$255,$256,$257,$258,$259,$260,$261,$262,$263,$264,$265,$266,$267,$268,$269,$270,$271,$272,$273,$274,$275,$276,$277,$278,$279,$280,$281,$282,$283,$284,$285,$286,$287,$288,$289,$290,$291,$292,$293,$294,$295,$296,$297,$298,$299,$300,$301,$302,$303,$304,$305,$306,$307,$308,$309,$310,$311,$312,$313,$314,$315,$316,$317,$318,$319,$320,$321,$322,$323,$324,$325,$326,$327,$328,$329,$330,$331,$332,$333,$334,$335,$336,$337,$338,$339,$340,$341,$342,$343,$344,$345,$346,$347,$348,$349,$350,$351,$352,$353,$354,$355,$356,$357,$358,$359,$360,$361,$362,$363,$364,$365,$366,$367,$368,$369,$370,$371,$372,$373,$374,$375,$376,$377,$378,$379,$380,$381,$382,$383,$384,$385,$386,$387,$388,$389,$390,$391,$392,$393,$394,$395,$396,$397,$398,$399,$400,$401,$402,$403,$404,$405,$406,$407,$408,$409,$410]);
  1887. return $1;
  1888. }, function($ctx1) {$ctx1.fill(self,"defaultMimeTypes",{},smalltalk.FileServer.klass)})},
  1889. args: [],
  1890. source: "defaultMimeTypes\x0a\x09^ #{\x0a\x09\x09'%' -> 'application/x-trash'.\x0a\x09\x09'323' -> 'text/h323'.\x0a\x09\x09'abw' -> 'application/x-abiword'.\x0a\x09\x09'ai' -> 'application/postscript'.\x0a\x09\x09'aif' -> 'audio/x-aiff'.\x0a\x09\x09'aifc' -> 'audio/x-aiff'.\x0a\x09\x09'aiff' -> 'audio/x-aiff'.\x0a\x09\x09'alc' -> 'chemical/x-alchemy'.\x0a\x09\x09'art' -> 'image/x-jg'.\x0a\x09\x09'asc' -> 'text/plain'.\x0a\x09\x09'asf' -> 'video/x-ms-asf'.\x0a\x09\x09'asn' -> 'chemical/x-ncbi-asn1-spec'.\x0a\x09\x09'aso' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'asx' -> 'video/x-ms-asf'.\x0a\x09\x09'au' -> 'audio/basic'.\x0a\x09\x09'avi' -> 'video/x-msvideo'.\x0a\x09\x09'b' -> 'chemical/x-molconn-Z'.\x0a\x09\x09'bak' -> 'application/x-trash'.\x0a\x09\x09'bat' -> 'application/x-msdos-program'.\x0a\x09\x09'bcpio' -> 'application/x-bcpio'.\x0a\x09\x09'bib' -> 'text/x-bibtex'.\x0a\x09\x09'bin' -> 'application/octet-stream'.\x0a\x09\x09'bmp' -> 'image/x-ms-bmp'.\x0a\x09\x09'book' -> 'application/x-maker'.\x0a\x09\x09'bsd' -> 'chemical/x-crossfire'.\x0a\x09\x09'c' -> 'text/x-csrc'.\x0a\x09\x09'c++' -> 'text/x-c++src'.\x0a\x09\x09'c3d' -> 'chemical/x-chem3d'.\x0a\x09\x09'cac' -> 'chemical/x-cache'.\x0a\x09\x09'cache' -> 'chemical/x-cache'.\x0a\x09\x09'cascii' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cat' -> 'application/vnd.ms-pki.seccat'.\x0a\x09\x09'cbin' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'cc' -> 'text/x-c++src'.\x0a\x09\x09'cdf' -> 'application/x-cdf'.\x0a\x09\x09'cdr' -> 'image/x-coreldraw'.\x0a\x09\x09'cdt' -> 'image/x-coreldrawtemplate'.\x0a\x09\x09'cdx' -> 'chemical/x-cdx'.\x0a\x09\x09'cdy' -> 'application/vnd.cinderella'.\x0a\x09\x09'cef' -> 'chemical/x-cxf'.\x0a\x09\x09'cer' -> 'chemical/x-cerius'.\x0a\x09\x09'chm' -> 'chemical/x-chemdraw'.\x0a\x09\x09'chrt' -> 'application/x-kchart'.\x0a\x09\x09'cif' -> 'chemical/x-cif'.\x0a\x09\x09'class' -> 'application/java-vm'.\x0a\x09\x09'cls' -> 'text/x-tex'.\x0a\x09\x09'cmdf' -> 'chemical/x-cmdf'.\x0a\x09\x09'cml' -> 'chemical/x-cml'.\x0a\x09\x09'cod' -> 'application/vnd.rim.cod'.\x0a\x09\x09'com' -> 'application/x-msdos-program'.\x0a\x09\x09'cpa' -> 'chemical/x-compass'.\x0a\x09\x09'cpio' -> 'application/x-cpio'.\x0a\x09\x09'cpp' -> 'text/x-c++src'.\x0a\x09\x09'cpt' -> 'image/x-corelphotopaint'.\x0a\x09\x09'crl' -> 'application/x-pkcs7-crl'.\x0a\x09\x09'crt' -> 'application/x-x509-ca-cert'.\x0a\x09\x09'csf' -> 'chemical/x-cache-csf'.\x0a\x09\x09'csh' -> 'text/x-csh'.\x0a\x09\x09'csm' -> 'chemical/x-csml'.\x0a\x09\x09'csml' -> 'chemical/x-csml'.\x0a\x09\x09'css' -> 'text/css'.\x0a\x09\x09'csv' -> 'text/comma-separated-values'.\x0a\x09\x09'ctab' -> 'chemical/x-cactvs-binary'.\x0a\x09\x09'ctx' -> 'chemical/x-ctx'.\x0a\x09\x09'cu' -> 'application/cu-seeme'.\x0a\x09\x09'cub' -> 'chemical/x-gaussian-cube'.\x0a\x09\x09'cxf' -> 'chemical/x-cxf'.\x0a\x09\x09'cxx' -> 'text/x-c++src'.\x0a\x09\x09'dat' -> 'chemical/x-mopac-input'.\x0a\x09\x09'dcr' -> 'application/x-director'.\x0a\x09\x09'deb' -> 'application/x-debian-package'.\x0a\x09\x09'dif' -> 'video/dv'.\x0a\x09\x09'diff' -> 'text/plain'.\x0a\x09\x09'dir' -> 'application/x-director'.\x0a\x09\x09'djv' -> 'image/vnd.djvu'.\x0a\x09\x09'djvu' -> 'image/vnd.djvu'.\x0a\x09\x09'dl' -> 'video/dl'.\x0a\x09\x09'dll' -> 'application/x-msdos-program'.\x0a\x09\x09'dmg' -> 'application/x-apple-diskimage'.\x0a\x09\x09'dms' -> 'application/x-dms'.\x0a\x09\x09'doc' -> 'application/msword'.\x0a\x09\x09'dot' -> 'application/msword'.\x0a\x09\x09'dv' -> 'video/dv'.\x0a\x09\x09'dvi' -> 'application/x-dvi'.\x0a\x09\x09'dx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'dxr' -> 'application/x-director'.\x0a\x09\x09'emb' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'embl' -> 'chemical/x-embl-dl-nucleotide'.\x0a\x09\x09'ent' -> 'chemical/x-pdb'.\x0a\x09\x09'eps' -> 'application/postscript'.\x0a\x09\x09'etx' -> 'text/x-setext'.\x0a\x09\x09'exe' -> 'application/x-msdos-program'.\x0a\x09\x09'ez' -> 'application/andrew-inset'.\x0a\x09\x09'fb' -> 'application/x-maker'.\x0a\x09\x09'fbdoc' -> 'application/x-maker'.\x0a\x09\x09'fch' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fchk' -> 'chemical/x-gaussian-checkpoint'.\x0a\x09\x09'fig' -> 'application/x-xfig'.\x0a\x09\x09'flac' -> 'application/x-flac'.\x0a\x09\x09'fli' -> 'video/fli'.\x0a\x09\x09'fm' -> 'application/x-maker'.\x0a\x09\x09'frame' -> 'application/x-maker'.\x0a\x09\x09'frm' -> 'application/x-maker'.\x0a\x09\x09'gal' -> 'chemical/x-gaussian-log'.\x0a\x09\x09'gam' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gamin' -> 'chemical/x-gamess-input'.\x0a\x09\x09'gau' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gcd' -> 'text/x-pcs-gcd'.\x0a\x09\x09'gcf' -> 'application/x-graphing-calculator'.\x0a\x09\x09'gcg' -> 'chemical/x-gcg8-sequence'.\x0a\x09\x09'gen' -> 'chemical/x-genbank'.\x0a\x09\x09'gf' -> 'application/x-tex-gf'.\x0a\x09\x09'gif' -> 'image/gif'.\x0a\x09\x09'gjc' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gjf' -> 'chemical/x-gaussian-input'.\x0a\x09\x09'gl' -> 'video/gl'.\x0a\x09\x09'gnumeric' -> 'application/x-gnumeric'.\x0a\x09\x09'gpt' -> 'chemical/x-mopac-graph'.\x0a\x09\x09'gsf' -> 'application/x-font'.\x0a\x09\x09'gsm' -> 'audio/x-gsm'.\x0a\x09\x09'gtar' -> 'application/x-gtar'.\x0a\x09\x09'h' -> 'text/x-chdr'.\x0a\x09\x09'h++' -> 'text/x-c++hdr'.\x0a\x09\x09'hdf' -> 'application/x-hdf'.\x0a\x09\x09'hh' -> 'text/x-c++hdr'.\x0a\x09\x09'hin' -> 'chemical/x-hin'.\x0a\x09\x09'hpp' -> 'text/x-c++hdr'.\x0a\x09\x09'hqx' -> 'application/mac-binhex40'.\x0a\x09\x09'hs' -> 'text/x-haskell'.\x0a\x09\x09'hta' -> 'application/hta'.\x0a\x09\x09'htc' -> 'text/x-component'.\x0a\x09\x09'htm' -> 'text/html'.\x0a\x09\x09'html' -> 'text/html'.\x0a\x09\x09'hxx' -> 'text/x-c++hdr'.\x0a\x09\x09'ica' -> 'application/x-ica'.\x0a\x09\x09'ice' -> 'x-conference/x-cooltalk'.\x0a\x09\x09'ico' -> 'image/x-icon'.\x0a\x09\x09'ics' -> 'text/calendar'.\x0a\x09\x09'icz' -> 'text/calendar'.\x0a\x09\x09'ief' -> 'image/ief'.\x0a\x09\x09'iges' -> 'model/iges'.\x0a\x09\x09'igs' -> 'model/iges'.\x0a\x09\x09'iii' -> 'application/x-iphone'.\x0a\x09\x09'inp' -> 'chemical/x-gamess-input'.\x0a\x09\x09'ins' -> 'application/x-internet-signup'.\x0a\x09\x09'iso' -> 'application/x-iso9660-image'.\x0a\x09\x09'isp' -> 'application/x-internet-signup'.\x0a\x09\x09'ist' -> 'chemical/x-isostar'.\x0a\x09\x09'istr' -> 'chemical/x-isostar'.\x0a\x09\x09'jad' -> 'text/vnd.sun.j2me.app-descriptor'.\x0a\x09\x09'jar' -> 'application/java-archive'.\x0a\x09\x09'java' -> 'text/x-java'.\x0a\x09\x09'jdx' -> 'chemical/x-jcamp-dx'.\x0a\x09\x09'jmz' -> 'application/x-jmol'.\x0a\x09\x09'jng' -> 'image/x-jng'.\x0a\x09\x09'jnlp' -> 'application/x-java-jnlp-file'.\x0a\x09\x09'jpe' -> 'image/jpeg'.\x0a\x09\x09'jpeg' -> 'image/jpeg'.\x0a\x09\x09'jpg' -> 'image/jpeg'.\x0a\x09\x09'js' -> 'application/javascript'.\x0a\x09\x09'kar' -> 'audio/midi'.\x0a\x09\x09'key' -> 'application/pgp-keys'.\x0a\x09\x09'kil' -> 'application/x-killustrator'.\x0a\x09\x09'kin' -> 'chemical/x-kinemage'.\x0a\x09\x09'kpr' -> 'application/x-kpresenter'.\x0a\x09\x09'kpt' -> 'application/x-kpresenter'.\x0a\x09\x09'ksp' -> 'application/x-kspread'.\x0a\x09\x09'kwd' -> 'application/x-kword'.\x0a\x09\x09'kwt' -> 'application/x-kword'.\x0a\x09\x09'latex' -> 'application/x-latex'.\x0a\x09\x09'lha' -> 'application/x-lha'.\x0a\x09\x09'lhs' -> 'text/x-literate-haskell'.\x0a\x09\x09'lsf' -> 'video/x-la-asf'.\x0a\x09\x09'lsx' -> 'video/x-la-asf'.\x0a\x09\x09'ltx' -> 'text/x-tex'.\x0a\x09\x09'lzh' -> 'application/x-lzh'.\x0a\x09\x09'lzx' -> 'application/x-lzx'.\x0a\x09\x09'm3u' -> 'audio/x-mpegurl'.\x0a\x09\x09'm4a' -> 'audio/mpeg'.\x0a\x09\x09'maker' -> 'application/x-maker'.\x0a\x09\x09'man' -> 'application/x-troff-man'.\x0a\x09\x09'mcif' -> 'chemical/x-mmcif'.\x0a\x09\x09'mcm' -> 'chemical/x-macmolecule'.\x0a\x09\x09'mdb' -> 'application/msaccess'.\x0a\x09\x09'me' -> 'application/x-troff-me'.\x0a\x09\x09'mesh' -> 'model/mesh'.\x0a\x09\x09'mid' -> 'audio/midi'.\x0a\x09\x09'midi' -> 'audio/midi'.\x0a\x09\x09'mif' -> 'application/x-mif'.\x0a\x09\x09'mm' -> 'application/x-freemind'.\x0a\x09\x09'mmd' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mmf' -> 'application/vnd.smaf'.\x0a\x09\x09'mml' -> 'text/mathml'.\x0a\x09\x09'mmod' -> 'chemical/x-macromodel-input'.\x0a\x09\x09'mng' -> 'video/x-mng'.\x0a\x09\x09'moc' -> 'text/x-moc'.\x0a\x09\x09'mol' -> 'chemical/x-mdl-molfile'.\x0a\x09\x09'mol2' -> 'chemical/x-mol2'.\x0a\x09\x09'moo' -> 'chemical/x-mopac-out'.\x0a\x09\x09'mop' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mopcrt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mov' -> 'video/quicktime'.\x0a\x09\x09'movie' -> 'video/x-sgi-movie'.\x0a\x09\x09'mp2' -> 'audio/mpeg'.\x0a\x09\x09'mp3' -> 'audio/mpeg'.\x0a\x09\x09'mp4' -> 'video/mp4'.\x0a\x09\x09'mpc' -> 'chemical/x-mopac-input'.\x0a\x09\x09'mpe' -> 'video/mpeg'.\x0a\x09\x09'mpeg' -> 'video/mpeg'.\x0a\x09\x09'mpega' -> 'audio/mpeg'.\x0a\x09\x09'mpg' -> 'video/mpeg'.\x0a\x09\x09'mpga' -> 'audio/mpeg'.\x0a\x09\x09'ms' -> 'application/x-troff-ms'.\x0a\x09\x09'msh' -> 'model/mesh'.\x0a\x09\x09'msi' -> 'application/x-msi'.\x0a\x09\x09'mvb' -> 'chemical/x-mopac-vib'.\x0a\x09\x09'mxu' -> 'video/vnd.mpegurl'.\x0a\x09\x09'nb' -> 'application/mathematica'.\x0a\x09\x09'nc' -> 'application/x-netcdf'.\x0a\x09\x09'nwc' -> 'application/x-nwc'.\x0a\x09\x09'o' -> 'application/x-object'.\x0a\x09\x09'oda' -> 'application/oda'.\x0a\x09\x09'odb' -> 'application/vnd.oasis.opendocument.database'.\x0a\x09\x09'odc' -> 'application/vnd.oasis.opendocument.chart'.\x0a\x09\x09'odf' -> 'application/vnd.oasis.opendocument.formula'.\x0a\x09\x09'odg' -> 'application/vnd.oasis.opendocument.graphics'.\x0a\x09\x09'odi' -> 'application/vnd.oasis.opendocument.image'.\x0a\x09\x09'odm' -> 'application/vnd.oasis.opendocument.text-master'.\x0a\x09\x09'odp' -> 'application/vnd.oasis.opendocument.presentation'.\x0a\x09\x09'ods' -> 'application/vnd.oasis.opendocument.spreadsheet'.\x0a\x09\x09'odt' -> 'application/vnd.oasis.opendocument.text'.\x0a\x09\x09'ogg' -> 'application/ogg'.\x0a\x09\x09'old' -> 'application/x-trash'.\x0a\x09\x09'oth' -> 'application/vnd.oasis.opendocument.text-web'.\x0a\x09\x09'oza' -> 'application/x-oz-application'.\x0a\x09\x09'p' -> 'text/x-pascal'.\x0a\x09\x09'p7r' -> 'application/x-pkcs7-certreqresp'.\x0a\x09\x09'pac' -> 'application/x-ns-proxy-autoconfig'.\x0a\x09\x09'pas' -> 'text/x-pascal'.\x0a\x09\x09'pat' -> 'image/x-coreldrawpattern'.\x0a\x09\x09'pbm' -> 'image/x-portable-bitmap'.\x0a\x09\x09'pcf' -> 'application/x-font'.\x0a\x09\x09'pcf.Z' -> 'application/x-font'.\x0a\x09\x09'pcx' -> 'image/pcx'.\x0a\x09\x09'pdb' -> 'chemical/x-pdb'.\x0a\x09\x09'pdf' -> 'application/pdf'.\x0a\x09\x09'pfa' -> 'application/x-font'.\x0a\x09\x09'pfb' -> 'application/x-font'.\x0a\x09\x09'pgm' -> 'image/x-portable-graymap'.\x0a\x09\x09'pgn' -> 'application/x-chess-pgn'.\x0a\x09\x09'pgp' -> 'application/pgp-signature'.\x0a\x09\x09'pk' -> 'application/x-tex-pk'.\x0a\x09\x09'pl' -> 'text/x-perl'.\x0a\x09\x09'pls' -> 'audio/x-scpls'.\x0a\x09\x09'pm' -> 'text/x-perl'.\x0a\x09\x09'png' -> 'image/png'.\x0a\x09\x09'pnm' -> 'image/x-portable-anymap'.\x0a\x09\x09'pot' -> 'text/plain'.\x0a\x09\x09'ppm' -> 'image/x-portable-pixmap'.\x0a\x09\x09'pps' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'ppt' -> 'application/vnd.ms-powerpoint'.\x0a\x09\x09'prf' -> 'application/pics-rules'.\x0a\x09\x09'prt' -> 'chemical/x-ncbi-asn1-ascii'.\x0a\x09\x09'ps' -> 'application/postscript'.\x0a\x09\x09'psd' -> 'image/x-photoshop'.\x0a\x09\x09'psp' -> 'text/x-psp'.\x0a\x09\x09'py' -> 'text/x-python'.\x0a\x09\x09'pyc' -> 'application/x-python-code'.\x0a\x09\x09'pyo' -> 'application/x-python-code'.\x0a\x09\x09'qt' -> 'video/quicktime'.\x0a\x09\x09'qtl' -> 'application/x-quicktimeplayer'.\x0a\x09\x09'ra' -> 'audio/x-realaudio'.\x0a\x09\x09'ram' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'rar' -> 'application/rar'.\x0a\x09\x09'ras' -> 'image/x-cmu-raster'.\x0a\x09\x09'rd' -> 'chemical/x-mdl-rdfile'.\x0a\x09\x09'rdf' -> 'application/rdf+xml'.\x0a\x09\x09'rgb' -> 'image/x-rgb'.\x0a\x09\x09'rm' -> 'audio/x-pn-realaudio'.\x0a\x09\x09'roff' -> 'application/x-troff'.\x0a\x09\x09'ros' -> 'chemical/x-rosdal'.\x0a\x09\x09'rpm' -> 'application/x-redhat-package-manager'.\x0a\x09\x09'rss' -> 'application/rss+xml'.\x0a\x09\x09'rtf' -> 'text/rtf'.\x0a\x09\x09'rtx' -> 'text/richtext'.\x0a\x09\x09'rxn' -> 'chemical/x-mdl-rxnfile'.\x0a\x09\x09'sct' -> 'text/scriptlet'.\x0a\x09\x09'sd' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sd2' -> 'audio/x-sd2'.\x0a\x09\x09'sda' -> 'application/vnd.stardivision.draw'.\x0a\x09\x09'sdc' -> 'application/vnd.stardivision.calc'.\x0a\x09\x09'sdd' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdf' -> 'chemical/x-mdl-sdfile'.\x0a\x09\x09'sdp' -> 'application/vnd.stardivision.impress'.\x0a\x09\x09'sdw' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'ser' -> 'application/java-serialized-object'.\x0a\x09\x09'sgf' -> 'application/x-go-sgf'.\x0a\x09\x09'sgl' -> 'application/vnd.stardivision.writer-global'.\x0a\x09\x09'sh' -> 'text/x-sh'.\x0a\x09\x09'shar' -> 'application/x-shar'.\x0a\x09\x09'shtml' -> 'text/html'.\x0a\x09\x09'sid' -> 'audio/prs.sid'.\x0a\x09\x09'sik' -> 'application/x-trash'.\x0a\x09\x09'silo' -> 'model/mesh'.\x0a\x09\x09'sis' -> 'application/vnd.symbian.install'.\x0a\x09\x09'sit' -> 'application/x-stuffit'.\x0a\x09\x09'skd' -> 'application/x-koan'.\x0a\x09\x09'skm' -> 'application/x-koan'.\x0a\x09\x09'skp' -> 'application/x-koan'.\x0a\x09\x09'skt' -> 'application/x-koan'.\x0a\x09\x09'smf' -> 'application/vnd.stardivision.math'.\x0a\x09\x09'smi' -> 'application/smil'.\x0a\x09\x09'smil' -> 'application/smil'.\x0a\x09\x09'snd' -> 'audio/basic'.\x0a\x09\x09'spc' -> 'chemical/x-galactic-spc'.\x0a\x09\x09'spl' -> 'application/x-futuresplash'.\x0a\x09\x09'src' -> 'application/x-wais-source'.\x0a\x09\x09'stc' -> 'application/vnd.sun.xml.calc.template'.\x0a\x09\x09'std' -> 'application/vnd.sun.xml.draw.template'.\x0a\x09\x09'sti' -> 'application/vnd.sun.xml.impress.template'.\x0a\x09\x09'stl' -> 'application/vnd.ms-pki.stl'.\x0a\x09\x09'stw' -> 'application/vnd.sun.xml.writer.template'.\x0a\x09\x09'sty' -> 'text/x-tex'.\x0a\x09\x09'sv4cpio' -> 'application/x-sv4cpio'.\x0a\x09\x09'sv4crc' -> 'application/x-sv4crc'.\x0a\x09\x09'svg' -> 'image/svg+xml'.\x0a\x09\x09'svgz' -> 'image/svg+xml'.\x0a\x09\x09'sw' -> 'chemical/x-swissprot'.\x0a\x09\x09'swf' -> 'application/x-shockwave-flash'.\x0a\x09\x09'swfl' -> 'application/x-shockwave-flash'.\x0a\x09\x09'sxc' -> 'application/vnd.sun.xml.calc'.\x0a\x09\x09'sxd' -> 'application/vnd.sun.xml.draw'.\x0a\x09\x09'sxg' -> 'application/vnd.sun.xml.writer.global'.\x0a\x09\x09'sxi' -> 'application/vnd.sun.xml.impress'.\x0a\x09\x09'sxm' -> 'application/vnd.sun.xml.math'.\x0a\x09\x09'sxw' -> 'application/vnd.sun.xml.writer'.\x0a\x09\x09't' -> 'application/x-troff'.\x0a\x09\x09'tar' -> 'application/x-tar'.\x0a\x09\x09'taz' -> 'application/x-gtar'.\x0a\x09\x09'tcl' -> 'text/x-tcl'.\x0a\x09\x09'tex' -> 'text/x-tex'.\x0a\x09\x09'texi' -> 'application/x-texinfo'.\x0a\x09\x09'texinfo' -> 'application/x-texinfo'.\x0a\x09\x09'text' -> 'text/plain'.\x0a\x09\x09'tgf' -> 'chemical/x-mdl-tgf'.\x0a\x09\x09'tgz' -> 'application/x-gtar'.\x0a\x09\x09'tif' -> 'image/tiff'.\x0a\x09\x09'tiff' -> 'image/tiff'.\x0a\x09\x09'tk' -> 'text/x-tcl'.\x0a\x09\x09'tm' -> 'text/texmacs'.\x0a\x09\x09'torrent' -> 'application/x-bittorrent'.\x0a\x09\x09'tr' -> 'application/x-troff'.\x0a\x09\x09'ts' -> 'text/texmacs'.\x0a\x09\x09'tsp' -> 'application/dsptype'.\x0a\x09\x09'tsv' -> 'text/tab-separated-values'.\x0a\x09\x09'txt' -> 'text/plain'.\x0a\x09\x09'udeb' -> 'application/x-debian-package'.\x0a\x09\x09'uls' -> 'text/iuls'.\x0a\x09\x09'ustar' -> 'application/x-ustar'.\x0a\x09\x09'val' -> 'chemical/x-ncbi-asn1-binary'.\x0a\x09\x09'vcd' -> 'application/x-cdlink'.\x0a\x09\x09'vcf' -> 'text/x-vcard'.\x0a\x09\x09'vcs' -> 'text/x-vcalendar'.\x0a\x09\x09'vmd' -> 'chemical/x-vmd'.\x0a\x09\x09'vms' -> 'chemical/x-vamas-iso14976'.\x0a\x09\x09'vor' -> 'application/vnd.stardivision.writer'.\x0a\x09\x09'vrm' -> 'x-world/x-vrml'.\x0a\x09\x09'vrml' -> 'x-world/x-vrml'.\x0a\x09\x09'vsd' -> 'application/vnd.visio'.\x0a\x09\x09'wad' -> 'application/x-doom'.\x0a\x09\x09'wav' -> 'audio/x-wav'.\x0a\x09\x09'wax' -> 'audio/x-ms-wax'.\x0a\x09\x09'wbmp' -> 'image/vnd.wap.wbmp'.\x0a\x09\x09'wbxml' -> 'application/vnd.wap.wbxml'.\x0a\x09\x09'wk' -> 'application/x-123'.\x0a\x09\x09'wm' -> 'video/x-ms-wm'.\x0a\x09\x09'wma' -> 'audio/x-ms-wma'.\x0a\x09\x09'wmd' -> 'application/x-ms-wmd'.\x0a\x09\x09'wml' -> 'text/vnd.wap.wml'.\x0a\x09\x09'wmlc' -> 'application/vnd.wap.wmlc'.\x0a\x09\x09'wmls' -> 'text/vnd.wap.wmlscript'.\x0a\x09\x09'wmlsc' -> 'application/vnd.wap.wmlscriptc'.\x0a\x09\x09'wmv' -> 'video/x-ms-wmv'.\x0a\x09\x09'wmx' -> 'video/x-ms-wmx'.\x0a\x09\x09'wmz' -> 'application/x-ms-wmz'.\x0a\x09\x09'wp5' -> 'application/wordperfect5.1'.\x0a\x09\x09'wpd' -> 'application/wordperfect'.\x0a\x09\x09'wrl' -> 'x-world/x-vrml'.\x0a\x09\x09'wsc' -> 'text/scriptlet'.\x0a\x09\x09'wvx' -> 'video/x-ms-wvx'.\x0a\x09\x09'wz' -> 'application/x-wingz'.\x0a\x09\x09'xbm' -> 'image/x-xbitmap'.\x0a\x09\x09'xcf' -> 'application/x-xcf'.\x0a\x09\x09'xht' -> 'application/xhtml+xml'.\x0a\x09\x09'xhtml' -> 'application/xhtml+xml'.\x0a\x09\x09'xlb' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xls' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xlt' -> 'application/vnd.ms-excel'.\x0a\x09\x09'xml' -> 'application/xml'.\x0a\x09\x09'xpi' -> 'application/x-xpinstall'.\x0a\x09\x09'xpm' -> 'image/x-xpixmap'.\x0a\x09\x09'xsl' -> 'application/xml'.\x0a\x09\x09'xtel' -> 'chemical/x-xtel'.\x0a\x09\x09'xul' -> 'application/vnd.mozilla.xul+xml'.\x0a\x09\x09'xwd' -> 'image/x-xwindowdump'.\x0a\x09\x09'xyz' -> 'chemical/x-xyz'.\x0a\x09\x09'zip' -> 'application/zip'.\x0a\x09\x09'zmt' -> 'chemical/x-mopac-input'.\x0a\x09\x09'~' -> 'application/x-trash'\x0a\x09}",
  1891. messageSends: ["->"],
  1892. referencedClasses: []
  1893. }),
  1894. smalltalk.FileServer.klass);
  1895. smalltalk.addMethod(
  1896. smalltalk.method({
  1897. selector: "defaultPort",
  1898. category: 'accessing',
  1899. fn: function (){
  1900. var self=this;
  1901. return smalltalk.withContext(function($ctx1) {
  1902. return (4000);
  1903. }, function($ctx1) {$ctx1.fill(self,"defaultPort",{},smalltalk.FileServer.klass)})},
  1904. args: [],
  1905. source: "defaultPort\x0a\x09^4000",
  1906. messageSends: [],
  1907. referencedClasses: []
  1908. }),
  1909. smalltalk.FileServer.klass);
  1910. smalltalk.addMethod(
  1911. smalltalk.method({
  1912. selector: "main",
  1913. category: 'initialization',
  1914. fn: function (){
  1915. var self=this;
  1916. var fileServer,args;
  1917. function $FileServer(){return smalltalk.FileServer||(typeof FileServer=="undefined"?nil:FileServer)}
  1918. return smalltalk.withContext(function($ctx1) {
  1919. var $1,$2;
  1920. var $early={};
  1921. try {
  1922. args=_st(process)._argv();
  1923. _st(args)._removeFrom_to_((1),(3));
  1924. _st(args)._detect_ifNone_((function(each){
  1925. return smalltalk.withContext(function($ctx2) {
  1926. $1=_st(each).__eq("--help");
  1927. if(smalltalk.assert($1)){
  1928. return _st($FileServer())._printHelp();
  1929. };
  1930. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}),(function(){
  1931. return smalltalk.withContext(function($ctx2) {
  1932. fileServer=_st($FileServer())._createServerWithArguments_(args);
  1933. fileServer;
  1934. $2=_st(fileServer)._start();
  1935. throw $early=[$2];
  1936. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,3)})}));
  1937. return self}
  1938. catch(e) {if(e===$early)return e[0]; throw e}
  1939. }, function($ctx1) {$ctx1.fill(self,"main",{fileServer:fileServer,args:args},smalltalk.FileServer.klass)})},
  1940. args: [],
  1941. source: "main\x0a\x09\x22Main entry point for Amber applications.\x0a\x09 Creates and starts a FileServer instance.\x22\x0a\x09| fileServer args |\x0a\x09args := process argv.\x0a\x09\x22Remove the first args which contain the path to the node executable and the script file.\x22\x0a\x09args removeFrom: 1 to: 3.\x0a\x0a\x09args detect: [ :each |\x0a\x09\x09(each = '--help') ifTrue: [FileServer printHelp]]\x0a\x09ifNone: [\x0a\x09\x09fileServer := FileServer createServerWithArguments: args.\x0a\x09\x09^fileServer start]",
  1942. messageSends: ["argv", "removeFrom:to:", "detect:ifNone:", "ifTrue:", "=", "printHelp", "createServerWithArguments:", "start"],
  1943. referencedClasses: ["FileServer"]
  1944. }),
  1945. smalltalk.FileServer.klass);
  1946. smalltalk.addMethod(
  1947. smalltalk.method({
  1948. selector: "mimeTypeFor:",
  1949. category: 'accessing',
  1950. fn: function (aString){
  1951. var self=this;
  1952. return smalltalk.withContext(function($ctx1) {
  1953. var $1;
  1954. $1=_st(self._mimeTypes())._at_ifAbsent_(_st(aString)._replace_with_(".*[\x5c.]",""),(function(){
  1955. return smalltalk.withContext(function($ctx2) {
  1956. return "text/plain";
  1957. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  1958. return $1;
  1959. }, function($ctx1) {$ctx1.fill(self,"mimeTypeFor:",{aString:aString},smalltalk.FileServer.klass)})},
  1960. args: ["aString"],
  1961. source: "mimeTypeFor: aString\x0a\x09^self mimeTypes at: (aString replace: '.*[\x5c.]' with: '') ifAbsent: ['text/plain']",
  1962. messageSends: ["at:ifAbsent:", "mimeTypes", "replace:with:"],
  1963. referencedClasses: []
  1964. }),
  1965. smalltalk.FileServer.klass);
  1966. smalltalk.addMethod(
  1967. smalltalk.method({
  1968. selector: "mimeTypes",
  1969. category: 'accessing',
  1970. fn: function (){
  1971. var self=this;
  1972. return smalltalk.withContext(function($ctx1) {
  1973. var $2,$1;
  1974. $2=self["@mimeTypes"];
  1975. if(($receiver = $2) == nil || $receiver == null){
  1976. self["@mimeTypes"]=self._defaultMimeTypes();
  1977. $1=self["@mimeTypes"];
  1978. } else {
  1979. $1=$2;
  1980. };
  1981. return $1;
  1982. }, function($ctx1) {$ctx1.fill(self,"mimeTypes",{},smalltalk.FileServer.klass)})},
  1983. args: [],
  1984. source: "mimeTypes\x0a\x09^mimeTypes ifNil: [mimeTypes := self defaultMimeTypes]",
  1985. messageSends: ["ifNil:", "defaultMimeTypes"],
  1986. referencedClasses: []
  1987. }),
  1988. smalltalk.FileServer.klass);
  1989. smalltalk.addMethod(
  1990. smalltalk.method({
  1991. selector: "printHelp",
  1992. category: 'accessing',
  1993. fn: function (){
  1994. var self=this;
  1995. return smalltalk.withContext(function($ctx1) {
  1996. var $1,$2;
  1997. $1=_st(console)._log_("Available commandline options are:");
  1998. $ctx1.sendIdx["log:"]=1;
  1999. $2=_st(console)._log_("--help");
  2000. $ctx1.sendIdx["log:"]=2;
  2001. _st(self._commandLineSwitches())._do_((function(each){
  2002. return smalltalk.withContext(function($ctx2) {
  2003. return _st(console)._log_(_st(each).__comma(" <parameter>"));
  2004. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2005. return self}, function($ctx1) {$ctx1.fill(self,"printHelp",{},smalltalk.FileServer.klass)})},
  2006. args: [],
  2007. source: "printHelp\x0a\x09console log: 'Available commandline options are:'.\x0a\x09console log: '--help'.\x0a\x09self commandLineSwitches do: [ :each |\x0a\x09\x09console log: each, ' <parameter>']",
  2008. messageSends: ["log:", "do:", "commandLineSwitches", ","],
  2009. referencedClasses: []
  2010. }),
  2011. smalltalk.FileServer.klass);
  2012. smalltalk.addMethod(
  2013. smalltalk.method({
  2014. selector: "selectorForCommandLineSwitch:",
  2015. category: 'accessing',
  2016. fn: function (aSwitch){
  2017. var self=this;
  2018. return smalltalk.withContext(function($ctx1) {
  2019. var $3,$2,$1;
  2020. $3=_st(aSwitch)._replace_with_("^--","");
  2021. $2=_st($3)._replace_with_("-[a-z]",(function(each){
  2022. return smalltalk.withContext(function($ctx2) {
  2023. return _st(_st(each)._second())._asUppercase();
  2024. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2025. $ctx1.sendIdx["replace:with:"]=1;
  2026. $1=_st($2).__comma(":");
  2027. return $1;
  2028. }, function($ctx1) {$ctx1.fill(self,"selectorForCommandLineSwitch:",{aSwitch:aSwitch},smalltalk.FileServer.klass)})},
  2029. args: ["aSwitch"],
  2030. source: "selectorForCommandLineSwitch: aSwitch\x0a\x09\x22Remove the trailing '--', add ':' at the end\x0a\x09 and replace all occurences of a lowercase letter preceded by a '-' with\x0a\x09 the Uppercase letter.\x0a\x09 Example: --fallback-page becomes fallbackPage:\x22\x0a\x09^((aSwitch replace: '^--' with: '')\x0a\x09\x09replace: '-[a-z]' with: [ :each | each second asUppercase ]), ':'",
  2031. messageSends: [",", "replace:with:", "asUppercase", "second"],
  2032. referencedClasses: []
  2033. }),
  2034. smalltalk.FileServer.klass);
  2035. smalltalk.addClass('Repl', smalltalk.Object, ['readline', 'interface', 'util', 'session', 'resultCount', 'commands'], 'AmberCli');
  2036. smalltalk.Repl.comment="I am a class representing a REPL (Read Evaluate Print Loop) and provide a command line interface to Amber Smalltalk.\x0aOn the prompt you can type Amber statements which will be evaluated after pressing <Enter>.\x0aThe evaluation is comparable with executing a 'DoIt' in a workspace.\x0a\x0aMy runtime requirement is a functional Node.js executable with working Readline support.";
  2037. smalltalk.addMethod(
  2038. smalltalk.method({
  2039. selector: "addVariableNamed:to:",
  2040. category: 'private',
  2041. fn: function (aString,anObject){
  2042. var self=this;
  2043. var newClass,newObject;
  2044. return smalltalk.withContext(function($ctx1) {
  2045. var $1;
  2046. newClass=self._subclass_withVariable_(_st(anObject)._class(),aString);
  2047. self._encapsulateVariable_withValue_in_(aString,anObject,newClass);
  2048. newObject=_st(newClass)._new();
  2049. self._setPreviousVariablesFor_from_(newObject,anObject);
  2050. $1=newObject;
  2051. return $1;
  2052. }, function($ctx1) {$ctx1.fill(self,"addVariableNamed:to:",{aString:aString,anObject:anObject,newClass:newClass,newObject:newObject},smalltalk.Repl)})},
  2053. args: ["aString", "anObject"],
  2054. source: "addVariableNamed: aString to: anObject\x0a\x09| newClass newObject |\x0a\x09newClass := self subclass: anObject class withVariable: aString.\x0a\x09self encapsulateVariable: aString withValue: anObject in: newClass.\x0a\x09newObject := newClass new.\x0a\x09self setPreviousVariablesFor: newObject from: anObject.\x0a\x09^ newObject",
  2055. messageSends: ["subclass:withVariable:", "class", "encapsulateVariable:withValue:in:", "new", "setPreviousVariablesFor:from:"],
  2056. referencedClasses: []
  2057. }),
  2058. smalltalk.Repl);
  2059. smalltalk.addMethod(
  2060. smalltalk.method({
  2061. selector: "assignNewVariable:do:",
  2062. category: 'private',
  2063. fn: function (buffer,aBlock){
  2064. var self=this;
  2065. function $Error(){return smalltalk.Error||(typeof Error=="undefined"?nil:Error)}
  2066. function $ErrorHandler(){return smalltalk.ErrorHandler||(typeof ErrorHandler=="undefined"?nil:ErrorHandler)}
  2067. return smalltalk.withContext(function($ctx1) {
  2068. var $2,$4,$6,$5,$3,$1;
  2069. $1=self._parseAssignment_do_(buffer,(function(name,expr){
  2070. var varName,value;
  2071. return smalltalk.withContext(function($ctx2) {
  2072. $2=name;
  2073. if(($receiver = $2) == nil || $receiver == null){
  2074. varName=self._nextResultName();
  2075. } else {
  2076. varName=$2;
  2077. };
  2078. varName;
  2079. self["@session"]=self._addVariableNamed_to_(varName,self["@session"]);
  2080. self["@session"];
  2081. _st((function(){
  2082. return smalltalk.withContext(function($ctx3) {
  2083. $4=_st(varName).__comma(" := ");
  2084. $6=expr;
  2085. if(($receiver = $6) == nil || $receiver == null){
  2086. $5=buffer;
  2087. } else {
  2088. $5=$6;
  2089. };
  2090. $3=_st($4).__comma($5);
  2091. $ctx3.sendIdx[","]=1;
  2092. value=self._eval_on_($3,self["@session"]);
  2093. return value;
  2094. }, function($ctx3) {$ctx3.fillBlock({},$ctx2,3)})}))._on_do_($Error(),(function(e){
  2095. return smalltalk.withContext(function($ctx3) {
  2096. _st(_st($ErrorHandler())._new())._logError_(e);
  2097. value=nil;
  2098. return value;
  2099. }, function($ctx3) {$ctx3.fillBlock({e:e},$ctx2,5)})}));
  2100. return _st(aBlock)._value_value_(varName,value);
  2101. }, function($ctx2) {$ctx2.fillBlock({name:name,expr:expr,varName:varName,value:value},$ctx1,1)})}));
  2102. return $1;
  2103. }, function($ctx1) {$ctx1.fill(self,"assignNewVariable:do:",{buffer:buffer,aBlock:aBlock},smalltalk.Repl)})},
  2104. args: ["buffer", "aBlock"],
  2105. source: "assignNewVariable: buffer do: aBlock\x0a\x09\x22Assigns a new variable and calls the given block with the variable's name and value\x0a\x09 if buffer contains an assignment expression. If it doesn't the block is called with nil for\x0a\x09 both arguments.\x22\x0a\x09^ self parseAssignment: buffer do: [ :name :expr || varName value |\x0a\x09\x09varName := name ifNil: [self nextResultName].\x0a\x09\x09session := self addVariableNamed: varName to: session.\x0a\x09\x09[ value := self eval: varName, ' := ', (expr ifNil: [buffer]) on: session ]\x0a\x09\x09\x09on: Error\x0a\x09\x09\x09do: [ :e | ErrorHandler new logError: e. value := nil].\x0a\x09\x09aBlock value: varName value: value]",
  2106. messageSends: ["parseAssignment:do:", "ifNil:", "nextResultName", "addVariableNamed:to:", "on:do:", "eval:on:", ",", "logError:", "new", "value:value:"],
  2107. referencedClasses: ["Error", "ErrorHandler"]
  2108. }),
  2109. smalltalk.Repl);
  2110. smalltalk.addMethod(
  2111. smalltalk.method({
  2112. selector: "clearScreen",
  2113. category: 'actions',
  2114. fn: function (){
  2115. var self=this;
  2116. var esc,cls;
  2117. function $String(){return smalltalk.String||(typeof String=="undefined"?nil:String)}
  2118. return smalltalk.withContext(function($ctx1) {
  2119. var $2,$1;
  2120. esc=_st($String())._fromCharCode_((27));
  2121. $2=_st(esc).__comma("[2J");
  2122. $1=_st($2).__comma(esc);
  2123. $ctx1.sendIdx[","]=2;
  2124. cls=_st($1).__comma("[0;0f");
  2125. $ctx1.sendIdx[","]=1;
  2126. _st(_st(process)._stdout())._write_(cls);
  2127. _st(self["@interface"])._prompt();
  2128. return self}, function($ctx1) {$ctx1.fill(self,"clearScreen",{esc:esc,cls:cls},smalltalk.Repl)})},
  2129. args: [],
  2130. source: "clearScreen\x0a\x09| esc cls |\x0a\x09esc := String fromCharCode: 27.\x0a\x09cls := esc, '[2J', esc, '[0;0f'.\x0a\x09process stdout write: cls.\x0a\x09interface prompt",
  2131. messageSends: ["fromCharCode:", ",", "write:", "stdout", "prompt"],
  2132. referencedClasses: ["String"]
  2133. }),
  2134. smalltalk.Repl);
  2135. smalltalk.addMethod(
  2136. smalltalk.method({
  2137. selector: "close",
  2138. category: 'actions',
  2139. fn: function (){
  2140. var self=this;
  2141. return smalltalk.withContext(function($ctx1) {
  2142. _st(_st(process)._stdin())._destroy();
  2143. return self}, function($ctx1) {$ctx1.fill(self,"close",{},smalltalk.Repl)})},
  2144. args: [],
  2145. source: "close\x0a\x09process stdin destroy",
  2146. messageSends: ["destroy", "stdin"],
  2147. referencedClasses: []
  2148. }),
  2149. smalltalk.Repl);
  2150. smalltalk.addMethod(
  2151. smalltalk.method({
  2152. selector: "commands",
  2153. category: 'accessing',
  2154. fn: function (){
  2155. var self=this;
  2156. return smalltalk.withContext(function($ctx1) {
  2157. var $1;
  2158. $1=self["@commands"];
  2159. return $1;
  2160. }, function($ctx1) {$ctx1.fill(self,"commands",{},smalltalk.Repl)})},
  2161. args: [],
  2162. source: "commands\x0a\x09^ commands",
  2163. messageSends: [],
  2164. referencedClasses: []
  2165. }),
  2166. smalltalk.Repl);
  2167. smalltalk.addMethod(
  2168. smalltalk.method({
  2169. selector: "createInterface",
  2170. category: 'actions',
  2171. fn: function (){
  2172. var self=this;
  2173. return smalltalk.withContext(function($ctx1) {
  2174. var $1,$2,$3;
  2175. self["@interface"]=_st(self["@readline"])._createInterface_stdout_(_st(process)._stdin(),_st(process)._stdout());
  2176. $1=_st(self["@interface"])._on_do_("line",(function(buffer){
  2177. return smalltalk.withContext(function($ctx2) {
  2178. return self._processLine_(buffer);
  2179. }, function($ctx2) {$ctx2.fillBlock({buffer:buffer},$ctx1,1)})}));
  2180. $ctx1.sendIdx["on:do:"]=1;
  2181. $2=_st(self["@interface"])._on_do_("close",(function(){
  2182. return smalltalk.withContext(function($ctx2) {
  2183. return self._close();
  2184. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2185. self._printWelcome();
  2186. self._setupHotkeys();
  2187. $3=self._setPrompt();
  2188. _st(self["@interface"])._prompt();
  2189. return self}, function($ctx1) {$ctx1.fill(self,"createInterface",{},smalltalk.Repl)})},
  2190. args: [],
  2191. source: "createInterface\x0a\x09interface := readline createInterface: process stdin stdout: process stdout.\x0a\x09interface on: 'line' do: [:buffer | self processLine: buffer].\x0a\x09interface on: 'close' do: [self close].\x0a\x09self printWelcome; setupHotkeys; setPrompt.\x0a\x09interface prompt",
  2192. messageSends: ["createInterface:stdout:", "stdin", "stdout", "on:do:", "processLine:", "close", "printWelcome", "setupHotkeys", "setPrompt", "prompt"],
  2193. referencedClasses: []
  2194. }),
  2195. smalltalk.Repl);
  2196. smalltalk.addMethod(
  2197. smalltalk.method({
  2198. selector: "encapsulateVariable:withValue:in:",
  2199. category: 'private',
  2200. fn: function (aString,anObject,aClass){
  2201. var self=this;
  2202. var compiler;
  2203. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2204. return smalltalk.withContext(function($ctx1) {
  2205. var $2,$5,$4,$3,$1,$7,$9,$8,$6;
  2206. compiler=_st($Compiler())._new();
  2207. $2=compiler;
  2208. $5=_st(aString).__comma(": anObject ^ ");
  2209. $ctx1.sendIdx[","]=3;
  2210. $4=_st($5).__comma(aString);
  2211. $ctx1.sendIdx[","]=2;
  2212. $3=_st($4).__comma(" := anObject");
  2213. $ctx1.sendIdx[","]=1;
  2214. $1=_st($2)._install_forClass_category_($3,aClass,"session");
  2215. $ctx1.sendIdx["install:forClass:category:"]=1;
  2216. $7=compiler;
  2217. $9=_st(aString).__comma(" ^ ");
  2218. $8=_st($9).__comma(aString);
  2219. $ctx1.sendIdx[","]=4;
  2220. $6=_st($7)._install_forClass_category_($8,aClass,"session");
  2221. return self}, function($ctx1) {$ctx1.fill(self,"encapsulateVariable:withValue:in:",{aString:aString,anObject:anObject,aClass:aClass,compiler:compiler},smalltalk.Repl)})},
  2222. args: ["aString", "anObject", "aClass"],
  2223. source: "encapsulateVariable: aString withValue: anObject in: aClass\x0a\x09\x22Add getter and setter for given variable to session.\x22\x0a\x09| compiler |\x0a\x09compiler := Compiler new.\x0a\x09compiler install: aString, ': anObject ^ ', aString, ' := anObject' forClass: aClass category: 'session'.\x0a\x09compiler install: aString, ' ^ ', aString forClass: aClass category: 'session'.",
  2224. messageSends: ["new", "install:forClass:category:", ","],
  2225. referencedClasses: ["Compiler"]
  2226. }),
  2227. smalltalk.Repl);
  2228. smalltalk.addMethod(
  2229. smalltalk.method({
  2230. selector: "eval:",
  2231. category: 'actions',
  2232. fn: function (buffer){
  2233. var self=this;
  2234. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2235. return smalltalk.withContext(function($ctx1) {
  2236. var $1;
  2237. $1=self._eval_on_(buffer,_st($DoIt())._new());
  2238. return $1;
  2239. }, function($ctx1) {$ctx1.fill(self,"eval:",{buffer:buffer},smalltalk.Repl)})},
  2240. args: ["buffer"],
  2241. source: "eval: buffer\x0a\x09^ self eval: buffer on: DoIt new.",
  2242. messageSends: ["eval:on:", "new"],
  2243. referencedClasses: ["DoIt"]
  2244. }),
  2245. smalltalk.Repl);
  2246. smalltalk.addMethod(
  2247. smalltalk.method({
  2248. selector: "eval:on:",
  2249. category: 'actions',
  2250. fn: function (buffer,anObject){
  2251. var self=this;
  2252. var result;
  2253. function $Compiler(){return smalltalk.Compiler||(typeof Compiler=="undefined"?nil:Compiler)}
  2254. return smalltalk.withContext(function($ctx1) {
  2255. var $1,$2,$3;
  2256. $1=_st(buffer)._isEmpty();
  2257. if(! smalltalk.assert($1)){
  2258. self._try_catch_((function(){
  2259. return smalltalk.withContext(function($ctx2) {
  2260. result=_st(_st($Compiler())._new())._evaluateExpression_on_(buffer,anObject);
  2261. return result;
  2262. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}),(function(e){
  2263. return smalltalk.withContext(function($ctx2) {
  2264. $2=_st(e)._isSmalltalkError();
  2265. if(smalltalk.assert($2)){
  2266. return _st(e)._resignal();
  2267. } else {
  2268. return _st(_st(process)._stdout())._write_(_st(e)._jsStack());
  2269. };
  2270. }, function($ctx2) {$ctx2.fillBlock({e:e},$ctx1,3)})}));
  2271. };
  2272. $3=result;
  2273. return $3;
  2274. }, function($ctx1) {$ctx1.fill(self,"eval:on:",{buffer:buffer,anObject:anObject,result:result},smalltalk.Repl)})},
  2275. args: ["buffer", "anObject"],
  2276. source: "eval: buffer on: anObject\x0a\x09| result |\x0a\x09buffer isEmpty ifFalse: [\x0a\x09\x09self try: [\x0a\x09\x09\x09result := Compiler new evaluateExpression: buffer on: anObject]\x0a\x09\x09catch: [:e |\x0a\x09\x09\x09e isSmalltalkError\x0a\x09\x09\x09 ifTrue: [ e resignal ]\x0a\x09\x09\x09 ifFalse: [ process stdout write: e jsStack ]]].\x0a\x09^ result",
  2277. messageSends: ["ifFalse:", "isEmpty", "try:catch:", "evaluateExpression:on:", "new", "ifTrue:ifFalse:", "isSmalltalkError", "resignal", "write:", "stdout", "jsStack"],
  2278. referencedClasses: ["Compiler"]
  2279. }),
  2280. smalltalk.Repl);
  2281. smalltalk.addMethod(
  2282. smalltalk.method({
  2283. selector: "executeCommand:",
  2284. category: 'private',
  2285. fn: function (aString){
  2286. var self=this;
  2287. return smalltalk.withContext(function($ctx1) {
  2288. var $1;
  2289. var $early={};
  2290. try {
  2291. _st(self._commands())._keysAndValuesDo_((function(names,cmd){
  2292. return smalltalk.withContext(function($ctx2) {
  2293. $1=_st(names)._includes_(aString);
  2294. if(smalltalk.assert($1)){
  2295. _st(cmd)._value();
  2296. throw $early=[true];
  2297. };
  2298. }, function($ctx2) {$ctx2.fillBlock({names:names,cmd:cmd},$ctx1,1)})}));
  2299. return false;
  2300. }
  2301. catch(e) {if(e===$early)return e[0]; throw e}
  2302. }, function($ctx1) {$ctx1.fill(self,"executeCommand:",{aString:aString},smalltalk.Repl)})},
  2303. args: ["aString"],
  2304. source: "executeCommand: aString\x0a\x09\x22Tries to process the given string as a command. Returns true if it was a command, false if not.\x22\x0a\x09self commands keysAndValuesDo: [:names :cmd |\x0a\x09\x09(names includes: aString) ifTrue: [\x0a\x09\x09\x09cmd value.\x0a\x09\x09\x09^ true]].\x0a\x09^ false",
  2305. messageSends: ["keysAndValuesDo:", "commands", "ifTrue:", "includes:", "value"],
  2306. referencedClasses: []
  2307. }),
  2308. smalltalk.Repl);
  2309. smalltalk.addMethod(
  2310. smalltalk.method({
  2311. selector: "initialize",
  2312. category: 'initialization',
  2313. fn: function (){
  2314. var self=this;
  2315. function $DoIt(){return smalltalk.DoIt||(typeof DoIt=="undefined"?nil:DoIt)}
  2316. return smalltalk.withContext(function($ctx1) {
  2317. smalltalk.Repl.superclass.fn.prototype._initialize.apply(_st(self), []);
  2318. self["@session"]=_st($DoIt())._new();
  2319. self["@readline"]=_st(require)._value_("readline");
  2320. $ctx1.sendIdx["value:"]=1;
  2321. self["@util"]=_st(require)._value_("util");
  2322. self._setupCommands();
  2323. return self}, function($ctx1) {$ctx1.fill(self,"initialize",{},smalltalk.Repl)})},
  2324. args: [],
  2325. source: "initialize\x0a\x09super initialize.\x0a\x09session := DoIt new.\x0a\x09readline := require value: 'readline'.\x0a\x09util := require value: 'util'.\x0a\x09self setupCommands",
  2326. messageSends: ["initialize", "new", "value:", "setupCommands"],
  2327. referencedClasses: ["DoIt"]
  2328. }),
  2329. smalltalk.Repl);
  2330. smalltalk.addMethod(
  2331. smalltalk.method({
  2332. selector: "instanceVariableNamesFor:",
  2333. category: 'private',
  2334. fn: function (aClass){
  2335. var self=this;
  2336. return smalltalk.withContext(function($ctx1) {
  2337. var $2,$3,$5,$4,$1;
  2338. $2=_st(aClass)._superclass();
  2339. $ctx1.sendIdx["superclass"]=1;
  2340. if(($receiver = $2) == nil || $receiver == null){
  2341. $1=_st(aClass)._instanceVariableNames();
  2342. } else {
  2343. $3=_st(aClass)._instanceVariableNames();
  2344. $ctx1.sendIdx["instanceVariableNames"]=1;
  2345. $5=_st(aClass)._superclass();
  2346. $4=self._instanceVariableNamesFor_($5);
  2347. $1=_st($3)._copyWithAll_($4);
  2348. };
  2349. return $1;
  2350. }, function($ctx1) {$ctx1.fill(self,"instanceVariableNamesFor:",{aClass:aClass},smalltalk.Repl)})},
  2351. args: ["aClass"],
  2352. source: "instanceVariableNamesFor: aClass\x0a\x09\x22Yields all instance variable names for the given class, including inherited ones.\x22\x0a\x09^ aClass superclass\x0a\x09\x09ifNotNil: [\x0a\x09\x09\x09aClass instanceVariableNames copyWithAll: (self instanceVariableNamesFor: aClass superclass)]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass instanceVariableNames]",
  2353. messageSends: ["ifNotNil:ifNil:", "superclass", "copyWithAll:", "instanceVariableNames", "instanceVariableNamesFor:"],
  2354. referencedClasses: []
  2355. }),
  2356. smalltalk.Repl);
  2357. smalltalk.addMethod(
  2358. smalltalk.method({
  2359. selector: "isIdentifier:",
  2360. category: 'private',
  2361. fn: function (aString){
  2362. var self=this;
  2363. return smalltalk.withContext(function($ctx1) {
  2364. var $1;
  2365. $1=_st(aString)._match_("^[a-z_]\x5cw*$"._asRegexp());
  2366. return $1;
  2367. }, function($ctx1) {$ctx1.fill(self,"isIdentifier:",{aString:aString},smalltalk.Repl)})},
  2368. args: ["aString"],
  2369. source: "isIdentifier: aString\x0a\x09^ aString match: '^[a-z_]\x5cw*$' asRegexp",
  2370. messageSends: ["match:", "asRegexp"],
  2371. referencedClasses: []
  2372. }),
  2373. smalltalk.Repl);
  2374. smalltalk.addMethod(
  2375. smalltalk.method({
  2376. selector: "isVariableDefined:",
  2377. category: 'private',
  2378. fn: function (aString){
  2379. var self=this;
  2380. return smalltalk.withContext(function($ctx1) {
  2381. var $1;
  2382. $1=_st(self._instanceVariableNamesFor_(_st(self["@session"])._class()))._includes_(aString);
  2383. return $1;
  2384. }, function($ctx1) {$ctx1.fill(self,"isVariableDefined:",{aString:aString},smalltalk.Repl)})},
  2385. args: ["aString"],
  2386. source: "isVariableDefined: aString\x0a\x09^ (self instanceVariableNamesFor: session class) includes: aString",
  2387. messageSends: ["includes:", "instanceVariableNamesFor:", "class"],
  2388. referencedClasses: []
  2389. }),
  2390. smalltalk.Repl);
  2391. smalltalk.addMethod(
  2392. smalltalk.method({
  2393. selector: "nextResultName",
  2394. category: 'private',
  2395. fn: function (){
  2396. var self=this;
  2397. return smalltalk.withContext(function($ctx1) {
  2398. var $1,$2;
  2399. $1=self["@resultCount"];
  2400. if(($receiver = $1) == nil || $receiver == null){
  2401. self["@resultCount"]=(1);
  2402. } else {
  2403. self["@resultCount"]=_st(self["@resultCount"]).__plus((1));
  2404. };
  2405. $2="res".__comma(_st(self["@resultCount"])._asString());
  2406. return $2;
  2407. }, function($ctx1) {$ctx1.fill(self,"nextResultName",{},smalltalk.Repl)})},
  2408. args: [],
  2409. source: "nextResultName\x0a\x09resultCount := resultCount\x0a \x09ifNotNil: [resultCount + 1]\x0a \x09ifNil: [1].\x0a ^ 'res', resultCount asString",
  2410. messageSends: ["ifNotNil:ifNil:", "+", ",", "asString"],
  2411. referencedClasses: []
  2412. }),
  2413. smalltalk.Repl);
  2414. smalltalk.addMethod(
  2415. smalltalk.method({
  2416. selector: "onKeyPress:",
  2417. category: 'private',
  2418. fn: function (key){
  2419. var self=this;
  2420. return smalltalk.withContext(function($ctx1) {
  2421. var $1;
  2422. $1=_st(_st(key)._ctrl())._and_((function(){
  2423. return smalltalk.withContext(function($ctx2) {
  2424. return _st(_st(key)._name()).__eq("l");
  2425. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2426. if(smalltalk.assert($1)){
  2427. self._clearScreen();
  2428. };
  2429. return self}, function($ctx1) {$ctx1.fill(self,"onKeyPress:",{key:key},smalltalk.Repl)})},
  2430. args: ["key"],
  2431. source: "onKeyPress: key\x0a\x09(key ctrl and: [key name = 'l'])\x0a\x09\x09ifTrue: [self clearScreen]",
  2432. messageSends: ["ifTrue:", "and:", "ctrl", "=", "name", "clearScreen"],
  2433. referencedClasses: []
  2434. }),
  2435. smalltalk.Repl);
  2436. smalltalk.addMethod(
  2437. smalltalk.method({
  2438. selector: "parseAssignment:do:",
  2439. category: 'private',
  2440. fn: function (aString,aBlock){
  2441. var self=this;
  2442. var assignment;
  2443. return smalltalk.withContext(function($ctx1) {
  2444. var $3,$2,$4,$5,$1;
  2445. assignment=_st(_st(aString)._tokenize_(":="))._collect_((function(s){
  2446. return smalltalk.withContext(function($ctx2) {
  2447. return _st(s)._trimBoth();
  2448. }, function($ctx2) {$ctx2.fillBlock({s:s},$ctx1,1)})}));
  2449. $2=_st(_st(_st(assignment)._size()).__eq((2)))._and_((function(){
  2450. return smalltalk.withContext(function($ctx2) {
  2451. $3=_st(assignment)._first();
  2452. $ctx2.sendIdx["first"]=1;
  2453. return self._isIdentifier_($3);
  2454. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2455. if(smalltalk.assert($2)){
  2456. $4=aBlock;
  2457. $5=_st(assignment)._first();
  2458. $1=_st($4)._value_value_($5,_st(assignment)._last());
  2459. $ctx1.sendIdx["value:value:"]=1;
  2460. } else {
  2461. $1=_st(aBlock)._value_value_(nil,nil);
  2462. };
  2463. return $1;
  2464. }, function($ctx1) {$ctx1.fill(self,"parseAssignment:do:",{aString:aString,aBlock:aBlock,assignment:assignment},smalltalk.Repl)})},
  2465. args: ["aString", "aBlock"],
  2466. source: "parseAssignment: aString do: aBlock\x0a\x09\x22Assigns a new variable if the given string is an assignment expression. Calls the given block with name and value.\x0a\x09 If the string is not one no variable will be assigned and the block will be called with nil for both arguments.\x22\x0a\x09| assignment |\x0a\x09assignment := (aString tokenize: ':=') collect: [:s | s trimBoth].\x0a\x09^ (assignment size = 2 and: [self isIdentifier: assignment first])\x0a\x09\x09ifTrue: [ aBlock value: assignment first value: assignment last ]\x0a\x09\x09ifFalse: [ aBlock value: nil value: nil ]",
  2467. messageSends: ["collect:", "tokenize:", "trimBoth", "ifTrue:ifFalse:", "and:", "=", "size", "isIdentifier:", "first", "value:value:", "last"],
  2468. referencedClasses: []
  2469. }),
  2470. smalltalk.Repl);
  2471. smalltalk.addMethod(
  2472. smalltalk.method({
  2473. selector: "presentResultNamed:withValue:",
  2474. category: 'private',
  2475. fn: function (varName,value){
  2476. var self=this;
  2477. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2478. return smalltalk.withContext(function($ctx1) {
  2479. var $1,$2,$6,$5,$4,$3,$7;
  2480. $1=$Transcript();
  2481. $2=$1;
  2482. $6=_st(varName).__comma(": ");
  2483. $5=_st($6).__comma(_st(_st(value)._class())._name());
  2484. $ctx1.sendIdx[","]=3;
  2485. $4=_st($5).__comma(" = ");
  2486. $ctx1.sendIdx[","]=2;
  2487. $3=_st($4).__comma(_st(value)._asString());
  2488. $ctx1.sendIdx[","]=1;
  2489. _st($2)._show_($3);
  2490. $7=_st($1)._cr();
  2491. _st(self["@interface"])._prompt();
  2492. return self}, function($ctx1) {$ctx1.fill(self,"presentResultNamed:withValue:",{varName:varName,value:value},smalltalk.Repl)})},
  2493. args: ["varName", "value"],
  2494. source: "presentResultNamed: varName withValue: value\x0a\x09Transcript show: varName, ': ', value class name, ' = ', value asString; cr.\x0a\x09interface prompt",
  2495. messageSends: ["show:", ",", "name", "class", "asString", "cr", "prompt"],
  2496. referencedClasses: ["Transcript"]
  2497. }),
  2498. smalltalk.Repl);
  2499. smalltalk.addMethod(
  2500. smalltalk.method({
  2501. selector: "printWelcome",
  2502. category: 'actions',
  2503. fn: function (){
  2504. var self=this;
  2505. function $Transcript(){return smalltalk.Transcript||(typeof Transcript=="undefined"?nil:Transcript)}
  2506. function $Smalltalk(){return smalltalk.Smalltalk||(typeof Smalltalk=="undefined"?nil:Smalltalk)}
  2507. return smalltalk.withContext(function($ctx1) {
  2508. var $2,$6,$5,$4,$3,$1,$7,$8;
  2509. $2=$Transcript();
  2510. $6="Welcome to Amber version ".__comma(_st(_st($Smalltalk())._current())._version());
  2511. $5=_st($6).__comma(" (NodeJS ");
  2512. $ctx1.sendIdx[","]=3;
  2513. $4=_st($5).__comma(_st(_st(process)._versions())._node());
  2514. $ctx1.sendIdx[","]=2;
  2515. $3=_st($4).__comma(").");
  2516. $ctx1.sendIdx[","]=1;
  2517. $1=_st($2)._show_($3);
  2518. $ctx1.sendIdx["show:"]=1;
  2519. $7=$Transcript();
  2520. _st($7)._show_("Type :q to exit.");
  2521. $8=_st($7)._cr();
  2522. return self}, function($ctx1) {$ctx1.fill(self,"printWelcome",{},smalltalk.Repl)})},
  2523. args: [],
  2524. source: "printWelcome\x0a\x09Transcript show: 'Welcome to Amber version ', Smalltalk current version, ' (NodeJS ', process versions node, ').'.\x0a\x09Transcript show: 'Type :q to exit.'; cr.",
  2525. messageSends: ["show:", ",", "version", "current", "node", "versions", "cr"],
  2526. referencedClasses: ["Transcript", "Smalltalk"]
  2527. }),
  2528. smalltalk.Repl);
  2529. smalltalk.addMethod(
  2530. smalltalk.method({
  2531. selector: "processLine:",
  2532. category: 'private',
  2533. fn: function (buffer){
  2534. var self=this;
  2535. var show;
  2536. return smalltalk.withContext(function($ctx1) {
  2537. var $1,$2;
  2538. show=(function(varName,value){
  2539. return smalltalk.withContext(function($ctx2) {
  2540. return self._presentResultNamed_withValue_(varName,value);
  2541. }, function($ctx2) {$ctx2.fillBlock({varName:varName,value:value},$ctx1,1)})});
  2542. $1=self._executeCommand_(buffer);
  2543. if(! smalltalk.assert($1)){
  2544. $2=self._isVariableDefined_(buffer);
  2545. if(smalltalk.assert($2)){
  2546. _st(show)._value_value_(buffer,_st(self["@session"])._perform_(buffer));
  2547. } else {
  2548. self._assignNewVariable_do_(buffer,show);
  2549. };
  2550. };
  2551. return self}, function($ctx1) {$ctx1.fill(self,"processLine:",{buffer:buffer,show:show},smalltalk.Repl)})},
  2552. args: ["buffer"],
  2553. source: "processLine: buffer\x0a\x09\x22Processes lines entered through the readline interface.\x22\x0a\x09| show |\x0a\x09show := [:varName :value | self presentResultNamed: varName withValue: value].\x0a\x09(self executeCommand: buffer) ifFalse: [\x0a\x09\x09(self isVariableDefined: buffer)\x0a\x09\x09\x09ifTrue: [show value: buffer value: (session perform: buffer)]\x0a\x09\x09\x09ifFalse: [self assignNewVariable: buffer do: show]]",
  2554. messageSends: ["presentResultNamed:withValue:", "ifFalse:", "executeCommand:", "ifTrue:ifFalse:", "isVariableDefined:", "value:value:", "perform:", "assignNewVariable:do:"],
  2555. referencedClasses: []
  2556. }),
  2557. smalltalk.Repl);
  2558. smalltalk.addMethod(
  2559. smalltalk.method({
  2560. selector: "prompt",
  2561. category: 'accessing',
  2562. fn: function (){
  2563. var self=this;
  2564. return smalltalk.withContext(function($ctx1) {
  2565. return "amber >> ";
  2566. }, function($ctx1) {$ctx1.fill(self,"prompt",{},smalltalk.Repl)})},
  2567. args: [],
  2568. source: "prompt\x0a\x09^'amber >> '",
  2569. messageSends: [],
  2570. referencedClasses: []
  2571. }),
  2572. smalltalk.Repl);
  2573. smalltalk.addMethod(
  2574. smalltalk.method({
  2575. selector: "setPreviousVariablesFor:from:",
  2576. category: 'private',
  2577. fn: function (newObject,oldObject){
  2578. var self=this;
  2579. return smalltalk.withContext(function($ctx1) {
  2580. _st(self._instanceVariableNamesFor_(_st(oldObject)._class()))._do_((function(each){
  2581. return smalltalk.withContext(function($ctx2) {
  2582. return _st(newObject)._perform_withArguments_(_st(each).__comma(":"),[_st(oldObject)._perform_(each)]);
  2583. }, function($ctx2) {$ctx2.fillBlock({each:each},$ctx1,1)})}));
  2584. return self}, function($ctx1) {$ctx1.fill(self,"setPreviousVariablesFor:from:",{newObject:newObject,oldObject:oldObject},smalltalk.Repl)})},
  2585. args: ["newObject", "oldObject"],
  2586. source: "setPreviousVariablesFor: newObject from: oldObject\x0a\x09(self instanceVariableNamesFor: oldObject class) do: [:each |\x0a\x09\x09newObject perform: each, ':' withArguments: {oldObject perform: each}].",
  2587. messageSends: ["do:", "instanceVariableNamesFor:", "class", "perform:withArguments:", ",", "perform:"],
  2588. referencedClasses: []
  2589. }),
  2590. smalltalk.Repl);
  2591. smalltalk.addMethod(
  2592. smalltalk.method({
  2593. selector: "setPrompt",
  2594. category: 'actions',
  2595. fn: function (){
  2596. var self=this;
  2597. return smalltalk.withContext(function($ctx1) {
  2598. _st(self["@interface"])._setPrompt_(self._prompt());
  2599. return self}, function($ctx1) {$ctx1.fill(self,"setPrompt",{},smalltalk.Repl)})},
  2600. args: [],
  2601. source: "setPrompt\x0a\x09interface setPrompt: self prompt",
  2602. messageSends: ["setPrompt:", "prompt"],
  2603. referencedClasses: []
  2604. }),
  2605. smalltalk.Repl);
  2606. smalltalk.addMethod(
  2607. smalltalk.method({
  2608. selector: "setupCommands",
  2609. category: 'initialization',
  2610. fn: function (){
  2611. var self=this;
  2612. function $Dictionary(){return smalltalk.Dictionary||(typeof Dictionary=="undefined"?nil:Dictionary)}
  2613. return smalltalk.withContext(function($ctx1) {
  2614. var $1,$3,$4,$2;
  2615. $1=$Dictionary();
  2616. $3=_st([":q"]).__minus_gt((function(){
  2617. return smalltalk.withContext(function($ctx2) {
  2618. return _st(process)._exit();
  2619. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,1)})}));
  2620. $ctx1.sendIdx["->"]=1;
  2621. $4=_st([""]).__minus_gt((function(){
  2622. return smalltalk.withContext(function($ctx2) {
  2623. return _st(self["@interface"])._prompt();
  2624. }, function($ctx2) {$ctx2.fillBlock({},$ctx1,2)})}));
  2625. $2=[$3,$4];
  2626. self["@commands"]=_st($1)._from_($2);
  2627. return self}, function($ctx1) {$ctx1.fill(self,"setupCommands",{},smalltalk.Repl)})},
  2628. args: [],
  2629. source: "setupCommands\x0a\x09commands := Dictionary from: {\x0a\x09\x09{':q'} -> [process exit].\x0a\x09\x09{''} -> [interface prompt]}",
  2630. messageSends: ["from:", "->", "exit", "prompt"],
  2631. referencedClasses: ["Dictionary"]
  2632. }),
  2633. smalltalk.Repl);
  2634. smalltalk.addMethod(
  2635. smalltalk.method({
  2636. selector: "setupHotkeys",
  2637. category: 'initialization',
  2638. fn: function (){
  2639. var self=this;
  2640. return smalltalk.withContext(function($ctx1) {
  2641. var $1;
  2642. _st(_st(process)._stdin())._on_do_("keypress",(function(s,key){
  2643. return smalltalk.withContext(function($ctx2) {
  2644. $1=key;
  2645. if(($receiver = $1) == nil || $receiver == null){
  2646. return $1;
  2647. } else {
  2648. return self._onKeyPress_(key);
  2649. };
  2650. }, function($ctx2) {$ctx2.fillBlock({s:s,key:key},$ctx1,1)})}));
  2651. return self}, function($ctx1) {$ctx1.fill(self,"setupHotkeys",{},smalltalk.Repl)})},
  2652. args: [],
  2653. source: "setupHotkeys\x0a\x09process stdin on: 'keypress' do: [:s :key | key ifNotNil: [self onKeyPress: key]].",
  2654. messageSends: ["on:do:", "stdin", "ifNotNil:", "onKeyPress:"],
  2655. referencedClasses: []
  2656. }),
  2657. smalltalk.Repl);
  2658. smalltalk.addMethod(
  2659. smalltalk.method({
  2660. selector: "subclass:withVariable:",
  2661. category: 'private',
  2662. fn: function (aClass,varName){
  2663. var self=this;
  2664. function $ClassBuilder(){return smalltalk.ClassBuilder||(typeof ClassBuilder=="undefined"?nil:ClassBuilder)}
  2665. return smalltalk.withContext(function($ctx1) {
  2666. var $1;
  2667. $1=_st(_st($ClassBuilder())._new())._addSubclassOf_named_instanceVariableNames_package_(aClass,_st(self._subclassNameFor_(aClass))._asSymbol(),[varName],"Compiler-Core");
  2668. return $1;
  2669. }, function($ctx1) {$ctx1.fill(self,"subclass:withVariable:",{aClass:aClass,varName:varName},smalltalk.Repl)})},
  2670. args: ["aClass", "varName"],
  2671. source: "subclass: aClass withVariable: varName\x0a\x09\x22Create subclass with new variable.\x22\x0a\x09^ ClassBuilder new\x0a\x09\x09addSubclassOf: aClass\x0a\x09\x09named: (self subclassNameFor: aClass) asSymbol\x0a\x09\x09instanceVariableNames: {varName}\x0a\x09\x09package: 'Compiler-Core'",
  2672. messageSends: ["addSubclassOf:named:instanceVariableNames:package:", "new", "asSymbol", "subclassNameFor:"],
  2673. referencedClasses: ["ClassBuilder"]
  2674. }),
  2675. smalltalk.Repl);
  2676. smalltalk.addMethod(
  2677. smalltalk.method({
  2678. selector: "subclassNameFor:",
  2679. category: 'private',
  2680. fn: function (aClass){
  2681. var self=this;
  2682. return smalltalk.withContext(function($ctx1) {
  2683. var $3,$2,$7,$6,$5,$4,$8,$9,$1;
  2684. $3=_st(aClass)._name();
  2685. $ctx1.sendIdx["name"]=1;
  2686. $2=_st($3)._matchesOf_("\x5cd+$");
  2687. $ctx1.sendIdx["matchesOf:"]=1;
  2688. if(($receiver = $2) == nil || $receiver == null){
  2689. $9=_st(aClass)._name();
  2690. $1=_st($9).__comma("2");
  2691. } else {
  2692. var counter;
  2693. $7=_st(aClass)._name();
  2694. $ctx1.sendIdx["name"]=2;
  2695. $6=_st($7)._matchesOf_("\x5cd+$");
  2696. $5=_st($6)._first();
  2697. $4=_st($5)._asNumber();
  2698. counter=_st($4).__plus((1));
  2699. counter;
  2700. $8=_st(aClass)._name();
  2701. $ctx1.sendIdx["name"]=3;
  2702. $1=_st($8)._replaceRegexp_with_("\x5cd+$"._asRegexp(),_st(counter)._asString());
  2703. };
  2704. return $1;
  2705. }, function($ctx1) {$ctx1.fill(self,"subclassNameFor:",{aClass:aClass},smalltalk.Repl)})},
  2706. args: ["aClass"],
  2707. source: "subclassNameFor: aClass\x0a\x09^ (aClass name matchesOf: '\x5cd+$')\x0a\x09\x09ifNotNil: [ | counter |\x0a\x09\x09\x09counter := (aClass name matchesOf: '\x5cd+$') first asNumber + 1.\x0a\x09\x09\x09aClass name replaceRegexp: '\x5cd+$' asRegexp with: counter asString]\x0a\x09\x09ifNil: [\x0a\x09\x09\x09aClass name, '2'].",
  2708. messageSends: ["ifNotNil:ifNil:", "matchesOf:", "name", "+", "asNumber", "first", "replaceRegexp:with:", "asRegexp", "asString", ","],
  2709. referencedClasses: []
  2710. }),
  2711. smalltalk.Repl);
  2712. smalltalk.addMethod(
  2713. smalltalk.method({
  2714. selector: "main",
  2715. category: 'initialization',
  2716. fn: function (){
  2717. var self=this;
  2718. return smalltalk.withContext(function($ctx1) {
  2719. _st(self._new())._createInterface();
  2720. return self}, function($ctx1) {$ctx1.fill(self,"main",{},smalltalk.Repl.klass)})},
  2721. args: [],
  2722. source: "main\x0a\x09self new createInterface",
  2723. messageSends: ["createInterface", "new"],
  2724. referencedClasses: []
  2725. }),
  2726. smalltalk.Repl.klass);
  2727. });