summaryrefslogtreecommitdiff
path: root/runtime/start.apl
diff options
context:
space:
mode:
authorglenda <glenda@cirno>2022-09-10 17:14:51 +0000
committerglenda <glenda@cirno>2022-09-10 17:14:51 +0000
commita1a9641baeab04b954420122b6fd1c9428a757b5 (patch)
tree1d41db19a169d3d6d130841750968ccb3e974a85 /runtime/start.apl
parente2ebfbb7d19ff3b990eb51dc9843200053cbbf98 (diff)
Try some more
Diffstat (limited to 'runtime/start.apl')
-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> ')