80 REM **    *************
85 REM **      VCTOSC.BAS
90 REM **    *************
95 REM ** by Paul D. Bullock
100 PRINT"*******************************************"
110 PRINT"*******************************************"
120 PRINT"***  THIS PROGRAM READS A VISICALC DIF  ***"
130 PRINT"***  FILE AND CREATES A SUPERCALC       ***"
140 PRINT"***  EXECUTE FILE THAT WILL IN TURN     ***"
150 PRINT"***  CREATE A SPREADSHEET ESSENTIALLY   ***"
160 PRINT"***  THE SAME AS THE ORIGINAL           ***"
170 PRINT"***                                     ***"
190 PRINT"***             NOTE                    ***"
200 PRINT"***                                     ***"
210 PRINT"***  THE VISICALC DIF FILE MUST BE      ***"
220 PRINT"***        SAVED BY COLUMNS             ***"
230 PRINT"***  ALSO THE SUPERCALC DIRECTION       ***"
240 PRINT"***  INDICATOR MUST BE SET AS ' > '     ***"
250 PRINT"***  THIS CAN BE DONE BY MOVING THE     ***"
260 PRINT"***  CURSOR TO THE RIGHT ONE CELL       ***"
270 PRINT"***  BEFORE ISSUING THE EXECUTE         ***"
280 PRINT"***         COMMAND                     ***"
290 PRINT"***                                     ***"
300 PRINT"*******************************************"
310 PRINT"*******************************************"
320 REM ** THIS PROGRAM HAS IT'S ROOTS FROM
330 REM ** THE "LISTING A DIF FILE" PROGRAM FROM
340 REM ** SATN-18 THE "PROGRAMMERS GUIDE TO DIF"
350 REM ** PUBLISHED BY SOFTWARE ARTS, INC
360 REM ** IN 1980
500 DIM T(100) :REM  ** MAXIMUM OF 100 COLUMNS
510 DIM V#(100) :REM  ** T,V,V$ HOLD THE 
520 DIM V$(100) :REM ** TYPE INDICATOR, NUMBER
530             :REM ** VALUE AND STRING VALUE
540             :REM ** OF EACH ELEMENT IN A TUPLE
1000 GOSUB 5000   :REM ** CALL INITIALIZATION CODE
1010 GOSUB 6000   :REM ** READ HEADER
1011 REM ** THIS STATEMENT FORMATS CELL WIDTH TO CW
1012 PRINT#2,"/FG"+MID$(STR$(CW),2,LEN(STR$(CW))-1)
1020 FOR I=1 TO NT:REM ** READ ALL OF THE TUPLES(ROWS)
1030   PRINT "VALUES FOR ROW #"I
1040   GOSUB 7000 :REM ** GET A TUPLE(ROW)
1041   REM ** WHERE TO START THE SUPERCALC ROW
1042   PRINT #2,CHR$(61)+"A"+MID$(STR$(I),2,LEN(STR$(I))-1)
1050   FOR J=1 TO NV  :REM ** OUTPUT EACH ELEMENT
1055     REM ** OUTPUT NUMERIC VALUE DOUBLE PREC.
1060     IF T(J)=0 THEN PRINT#2,V#(J)
1062     REM ** OUTPUT NOTHING IF CELL IS BLANK
1065     IF T(J)=1 AND V$(J)="" THEN PRINT#2,V$(J):GOTO 1080
1067     REM ** OUTPUT STRING WITH QUOTES
1070     IF T(J)=1 THEN PRINT#2,CHR$(34)+V$(J)
1080   NEXT J
1090 NEXT I
1100 CLOSE
1110 PRINT"FINISHED CREATING SUPERCALC FILE ";G$
1120 END
5000               :REM ** INITIALIZATION CODE
5010 PRINT"ENTER VISICALC DIF FILE NAME"
5015 PRINT"INCLUDE THE .DIF"
5020 INPUT F$      :REM ** GET NAME OF FILE TO READ
5022 PRINT"ENTER THE COLUMN WIDTH IN VISICALC FILE"
5024 INPUT CW      :REM ** ENTER COLUMN WIDTH
5030 OPEN "I",#1,F$:REM ** OPEN FILE FOR READ
5032 PRINT"ENTER SUPERCALC EXECUTE FILE NAME"
5034 PRINT"INCLUDE THE .XQT"
5036 INPUT G$      :REM ** ENTER NAME OF FILE TO CREATE
5038 OPEN "O",#2,G$:REM ** OPEN FILE FOR OUTPUT
5040 NV=0          :REM ** INIT VECTOR COUNT
5050 NT=0          :REM ** INIT TUPLE COUNT
5060 RETURN
6000               :REM ** READ HEADER, SET NV AND NT
6010 INPUT #1,T$   :REM ** GET TOPIC NAME
6020 INPUT #1,S,N  :REM ** GET VECTOR NUMBER, VALUE
6030 INPUT #1,S$   :REM ** GET STRING 
6040 IF T$="VECTORS" THEN 6500 :REM ** CHECK FOR KNOWN HEADER
6050 IF T$="TUPLES" THEN 6600  :REM **       ITEMS
6060 IF T$="DATA" THEN RETURN  :REM ** DATA ENDS HEADER
6070 GOTO 6010                 :REM ** IGNORE UNKOWN ONES
6500 NV=N          :REM ** VALUE IS NUMBER OF VECTORS(COLS)
6510 PRINT"THE FILE HAS ";NV;" COLUMNS"
6520 IF NV<=100 THEN 6010      :REM ** IF NOT TOO MANY CONTINUE
6530 CLOSE         :REM ** IF TOO MANY STOP
6540 STOP
6600 NT=N          :REM ** VALUE IS NUMBER OF TUPLES(ROWS)
6610 PRINT"THE FILE HAS ";NT;" ROWS"
6620 GOTO 6010     :REM *** GET NEXT HEADER ITEM
7000 REM ** GET ALL VECTOR ELEMENTS IN A TUPLE
7010 GOSUB 8000    :REM ** GET NEXT DATA VALUE
7020 IF T1<>-1 THEN 9000         :REM ** MUST BE -1 AND
7030 IF S$<>"BOT" THEN 9000      :REM ** AND BOT OR ERROR
7040 FOR K=1 TO NV :REM ** GET EACH DATA VALUE
7050   GOSUB 8000  
7060   IF T1=-1 THEN 9000
7070   V#(K)=V1#     :REM ** SAVE VALUES AND TYPE
7080   V$(K)=S$    :REM ** INDICATOR
7090   T(K) =T1
7100 NEXT K
7110 RETURN
8000 REM ** GET NEXT DATA VALUE
8010 INPUT#1,T1,V1# :REM ** GET TYPE INDICATOR
8020 INPUT#1,S$    :REM ** NUMERIC VALUE AND STRING VALUE
8030 RETURN
9000 PRINT"ERROR IN FILE FORMAT"
9010 CLOSE
9020 STOP
20 INPUT#1,S$    :REM ** NUMERIC VALUE AND STRING VALUE
8030 RE