@@ -13,29 +13,41 @@ async def delay(time):
13
13
files = ['bigrat' , 'extensions' , 'turtleduck' , 'sundry/cards' , 'sundry/demo' , 'sundry/fsm' , 'sundry/heapsort' ]
14
14
15
15
for file in files :
16
+ print (f'Downloading { file } .qky... ' , end = '' )
16
17
# N. B. top-level await is only allowed in Pyodide
17
18
resp = await pyfetch (f'@@ORIGIN@@/{ file } .qky' )
18
- print (f'Downloading { file } .qky' )
19
19
text = await resp .string ()
20
20
with open (f'{ file } .qky' , 'w' ) as f : f .write (text )
21
+ delay (10 )
22
+ print ('done' )
21
23
22
- print ('Downloading quackery_OOP_ASYNC .py' )
24
+ print ('Downloading quackery_OOP .py... ' , end = ' ' )
23
25
resp = await pyfetch ('@@ORIGIN@@/quackery_OOP.py' )
24
26
quackerytext = await resp .string ()
25
27
with open ('quackery.py' , 'w' ) as f : f .write (quackerytext )
26
-
27
- js .term .clear ()
28
+ print ('done' )
28
29
29
30
async def ainput (prompt ):
30
31
term = js .term
31
32
term .resume ()
32
33
print ('\u200c ' , end = '' ) # ‌
33
- result = await term .read (prompt )
34
+ promise = term .read (prompt )
35
+ term .history ().enable ()
36
+ result = await promise
34
37
term .pause ()
35
38
return result
36
39
37
- from quackery import quackery , QuackeryContext
40
+ print ('Compiling builtins... ' , end = '' )
41
+ from quackery import *
38
42
qc = QuackeryContext ()
43
+ print ('done' )
44
+
45
+ quackery (r'''$ 'extensions.qky' dup name? not dip sharefile and iff [ say 'Compiling extensions... ' cr quackery say 'done' cr ] else drop''' , qc )
46
+
47
+ print ('Starting...' )
48
+ delay (1000 )
49
+ js .term .clear ()
50
+
39
51
print (r'''
40
52
___ _ ___ _ _
41
53
/ _ \ _ _ __ _ ___| | _____ _ __ _ _ / _ \ _ __ | (_)_ __ ___
@@ -46,8 +58,6 @@ async def ainput(prompt):
46
58
Welcome to Quackery running on the Pyodide virtual machine.
47
59
Don't type 'leave' or you'll break something.''' )
48
60
49
- quackery (r'''$ 'extensions.qky' dup name? not dip sharefile and iff [ cr say 'Building extensions...' cr quackery ] else drop''' , qc )
50
-
51
61
async def shell_loop ():
52
62
while True :
53
63
prompt = '/O> '
0 commit comments