summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorglenda <glenda@cirno>2022-09-11 09:42:42 +0000
committerglenda <glenda@cirno>2022-09-11 09:42:42 +0000
commite59277504e7b7441729a2c6a097c72eb4142704d (patch)
treefd84f5e3ce42027efbf2cccbf1a5dd67595c3ca4
parent759d2d541d943fe95138789477fa6faddf6e3e08 (diff)
Better handling of shy results in the session
-rw-r--r--main.c8
-rw-r--r--quadnames.c8
-rw-r--r--runtime/start.apl11
3 files changed, 13 insertions, 14 deletions
diff --git a/main.c b/main.c
index f74468c..17ab041 100644
--- a/main.c
+++ b/main.c
@@ -50,14 +50,8 @@ restart:
while(!off){
checkmem("main loop");
Datum *result = evalline(nil, stdin, 1);
- if(result && !result->shy)
+ if(result)
outputmain(result);
- else{
- Datum *dummy = allocdatum(ArrayTag, 0);
- dummy->array = mkrunearray(L"");
- outputmain(dummy);
- freedatum(dummy);
- }
freedatum(result);
/*
print("Unfreed arrays: %d\n", arrayalloccounts);
diff --git a/quadnames.c b/quadnames.c
index f00de5e..0727d3e 100644
--- a/quadnames.c
+++ b/quadnames.c
@@ -169,12 +169,16 @@ void
outputmain(Datum *d)
{
Rune *str = ppdatum(d);
- Array *strarray = mkrunearray(str);
+ Array *data = allocarray(AtypeArray, 1, 2);
+ data->shape[0] = 2;
+ data->arraydata[0] = mkscalarint(d->shy);
+ data->arraydata[1] = mkrunearray(str);
if(session)
- rundfn(L"0::⎕RAWIO←⍶ ⋄ ('→' ⍺) ⍈ ⍵", d, nil, strarray, session);
+ rundfn(L"0::⎕RAWIO←⍶ ⋄ ('→' (⍺)) ⍈ ⍵", d, nil, data, session);
else
setquadrawio(d);
free(str);
+ freearray(data);
}
/* ⎕RAWIO */
diff --git a/runtime/start.apl b/runtime/start.apl
index d65d0bc..64b8be8 100644
--- a/runtime/start.apl
+++ b/runtime/start.apl
@@ -8,9 +8,11 @@
}
handleMain←{
0::⍺
- data←⍵
- ⎕rawio←data
- ⎕rawio←⎕ucs 10
+ (shy data)←⍵
+ _←{
+ ⎕rawio←data
+ ⎕rawio←⎕ucs 10
+ } IF ~shy
⎕rawio←prompt
≢prompt
}
@@ -28,8 +30,7 @@
data←⍵
⎕rawio←data
⎕rawio←⎕ucs 10
- ⎕rawio←prompt
- ≢prompt
+ 0
}
handleQuoteQuad←{
0::⍺