Basic: reduce variables. Fix func printing.
[jackhill/mal.git] / basic / step6_file.in.bas
index a5eabb6..6b4f234 100755 (executable)
@@ -125,7 +125,7 @@ SUB EVAL
 
   IF ER<>-2 THEN GOTO EVAL_RETURN
 
-  REM AZ=A:PR=1:GOSUB PR_STR
+  REM AZ=A:B=1:GOSUB PR_STR
   REM PRINT "EVAL: "+R$+" [A:"+STR$(A)+", LV:"+STR$(LV)+"]"
 
   GOSUB DEREF_A
@@ -176,7 +176,7 @@ SUB EVAL
       IF ER<>-2 THEN GOTO EVAL_RETURN
 
       REM set a1 in env to a2
-      K=A1:V=R:GOSUB ENV_SET
+      K=A1:C=R:GOSUB ENV_SET
       GOTO EVAL_RETURN
 
     EVAL_LET:
@@ -187,7 +187,7 @@ SUB EVAL
       X=X+1:X%(X)=E: REM push env for for later release
 
       REM create new environment with outer as current environment
-      O=E:GOSUB ENV_NEW
+      C=E:GOSUB ENV_NEW
       E=R
       EVAL_LET_LOOP:
         IF Z%(A1,1)=0 THEN GOTO EVAL_LET_LOOP_DONE
@@ -200,7 +200,7 @@ SUB EVAL
         IF ER<>-2 THEN GOTO EVAL_LET_LOOP_DONE
 
         REM set environment: even A1 key to odd A1 eval'd above
-        K=A1+1:V=R:GOSUB ENV_SET
+        K=A1+1:C=R:GOSUB ENV_SET
         AY=R:GOSUB RELEASE: REM release our use, ENV_SET took ownership
 
         REM skip to the next pair of A1 elements
@@ -258,7 +258,7 @@ SUB EVAL
 
     EVAL_FN:
       GOSUB EVAL_GET_A2: REM set A1 and A2
-      A=A2:P=A1:GOSUB MAL_FUNCTION
+      A=A2:B=A1:GOSUB MAL_FUNCTION
       GOTO EVAL_RETURN
 
     EVAL_INVOKE:
@@ -283,7 +283,7 @@ SUB EVAL
 
       REM if error, pop and return f/args for release by caller
       R=X%(X):X=X-1
-      ER=-1:ER$="apply of non-function":GOTO EVAL_RETURN
+      ER=-1:E$="apply of non-function":GOTO EVAL_RETURN
 
       EVAL_DO_FUNCTION:
         REM regular function
@@ -300,7 +300,7 @@ SUB EVAL
         E4=E: REM save the current environment for release
 
         REM create new environ using env stored with function
-        O=Z%(F+1,1):BI=Z%(F+1,0):EX=AR:GOSUB ENV_NEW_BINDS
+        C=Z%(F+1,1):A=Z%(F+1,0):B=AR:GOSUB ENV_NEW_BINDS
 
         REM release previous env if it is not the top one on the
         REM stack (X%(X-2)) because our new env refers to it and
@@ -320,7 +320,7 @@ SUB EVAL
         E=R:GOTO EVAL_TCO_RECUR: REM TCO loop
 
   EVAL_RETURN:
-    REM AZ=R: PR=1: GOSUB PR_STR
+    REM AZ=R: B=1: GOSUB PR_STR
     REM PRINT "EVAL_RETURN R: ["+R$+"] ("+STR$(R)+"), LV:"+STR$(LV)+",ER:"+STR$(ER)
 
     REM release environment if not the top one on the stack
@@ -332,8 +332,8 @@ SUB EVAL
     GOSUB RELEASE_PEND
 
     REM trigger GC
-    #cbm TA=FRE(0)
-    #qbasic TA=0
+    #cbm T=FRE(0)
+    #qbasic T=0
 
     REM pop A and E off the stack
     E=X%(X-1):A=X%(X):X=X-2
@@ -342,7 +342,7 @@ END SUB
 
 REM PRINT(A) -> R$
 MAL_PRINT:
-  AZ=A:PR=1:GOSUB PR_STR
+  AZ=A:B=1:GOSUB PR_STR
   RETURN
 
 REM RE(A$) -> R
@@ -390,7 +390,7 @@ MAIN:
   LV=0
 
   REM create repl_env
-  O=-1:GOSUB ENV_NEW:D=R
+  C=-1:GOSUB ENV_NEW:D=R
 
   REM core.EXT: defined in Basic
   E=D:GOSUB INIT_CORE_NS: REM set core functions in repl_env
@@ -443,7 +443,7 @@ MAIN:
     END
 
   PRINT_ERROR:
-    PRINT "Error: "+ER$
-    ER=-2:ER$=""
+    PRINT "Error: "+E$
+    ER=-2:E$=""
     RETURN