summaryrefslogtreecommitdiff
path: root/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'runtime')
-rw-r--r--runtime/start.apl22
1 files changed, 17 insertions, 5 deletions
diff --git a/runtime/start.apl b/runtime/start.apl
index c98462e..70df0fb 100644
--- a/runtime/start.apl
+++ b/runtime/start.apl
@@ -1,8 +1,19 @@
⎕session←{
(indented main prompt)←⍵
+ ⎕rawio←'Welcome to APL9',(⎕ucs 10),prompt
+ indented←≢prompt
+
unindent←{
⎕rawio←⎕ucs ⍺⍴8
}
+ handleMain←{
+ 0::⍺
+ data←⍵
+ ⎕rawio←data
+ ⎕rawio←⎕ucs 10
+ ⎕rawio←prompt
+ ≢prompt
+ }
handleError←{
0::⍺
(task (error msg taskname))←⍵
@@ -31,11 +42,12 @@
(task (type data))←⍵
indented←⍺
_←indented∘unindent IF (indented>0)∧task≢main
- type≡'!': 0 handleError task data
- type≡'⎕': 0 handleQuad data
- type≡'⍞': 0 handleQuoteQuad data
+ indented←indented×task≡main
+ type≡'→': indented handleMain data
+ type≡'!': indented handleError task data
+ type≡'⎕': indented handleQuad data
+ type≡'⍞': indented handleQuoteQuad data
}
{∇ ⍵ handle {1 ⍵}⍇⍬} indented
-}&'session'⊢0 ⎕self (6⍴' ')
-⎕←'Welcome to APL9'
+}&'session'⊢0 ⎕self ('APL9> ')