Megatest

Check-in [a1e941a7b1]
Login
Overview
Comment:Closer
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: a1e941a7b13be44158a7b1aebdb5c837bf7ae7a8
User & Date: matt on 2013-07-14 17:22:03
Other Links: branch diff | manifest | tags
Context
2013-07-14
19:30
Mostly working check-in: d0d74baabc user: matt tags: dev
17:22
Closer check-in: a1e941a7b1 user: matt tags: dev
16:25
Closer check-in: cc4d262224 user: matt tags: dev
Changes

Modified txtdb/testdata.sxml from [4d861fcb89] to [0efca32b7e].

29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
44
45
46
47
48
49
50

51
52
53
54
55
56
57
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43
44
45
46
47
48
49

50
51
52
53
54
55
56
57







-
+













-
+







             (http://www.gnumeric.org/v10.dtd:type "4")
             (http://www.gnumeric.org/v10.dtd:name
               "WorkbookView::is_protected")
             (http://www.gnumeric.org/v10.dtd:value "FALSE")))
         (urn:oasis:names:tc:opendocument:xmlns:office:1.0:document-meta
           (@ (urn:oasis:names:tc:opendocument:xmlns:office:1.0:version "1.2"))
           (urn:oasis:names:tc:opendocument:xmlns:office:1.0:meta
             (http://purl.org/dc/elements/1.1/:date "2013-07-13T04:45:21Z")
             (http://purl.org/dc/elements/1.1/:date "2013-07-14T22:32:27Z")
             (urn:oasis:names:tc:opendocument:xmlns:meta:1.0:creation-date
               "2013-07-13T04:38:00Z")))
         (http://www.gnumeric.org/v10.dtd:Calculation
           (@ (MaxIterations "100")
              (ManualRecalc "0")
              (IterationTolerance "0.001")
              (FloatRadix "2")
              (FloatDigits "53")
              (EnableIteration "1")))
         (http://www.gnumeric.org/v10.dtd:SheetNameIndex
           (http://www.gnumeric.org/v10.dtd:SheetName
             (@ (http://www.gnumeric.org/v10.dtd:Rows "65536")
                (http://www.gnumeric.org/v10.dtd:Cols "256"))
             "First Sheet")
             "First_Sheet")
           (http://www.gnumeric.org/v10.dtd:SheetName
             (@ (http://www.gnumeric.org/v10.dtd:Rows "65536")
                (http://www.gnumeric.org/v10.dtd:Cols "256"))
             "Second-sheet")
           (http://www.gnumeric.org/v10.dtd:SheetName
             (@ (http://www.gnumeric.org/v10.dtd:Rows "65536")
                (http://www.gnumeric.org/v10.dtd:Cols "256"))
66
67
68
69
70
71
72
73

74
75
76
77
78
79
80
81
82
83
84

85
86
87
88
89
90
91
66
67
68
69
70
71
72

73
74
75
76
77
78
79
80
81
82
83

84
85
86
87
88
89
90
91







-
+










-
+







                (HideZero "0")
                (HideRowHeader "0")
                (HideGrid "0")
                (HideColHeader "0")
                (GridColor "0:0:0")
                (DisplayOutlines "1")
                (DisplayFormulas "0"))
             (http://www.gnumeric.org/v10.dtd:Name "First Sheet")
             (http://www.gnumeric.org/v10.dtd:Name "First_Sheet")
             (http://www.gnumeric.org/v10.dtd:MaxCol "8")
             (http://www.gnumeric.org/v10.dtd:MaxRow "17")
             (http://www.gnumeric.org/v10.dtd:Zoom "1")
             (http://www.gnumeric.org/v10.dtd:Names
               (http://www.gnumeric.org/v10.dtd:Name
                 (http://www.gnumeric.org/v10.dtd:name "Print_Area")
                 (http://www.gnumeric.org/v10.dtd:value "#REF!")
                 (http://www.gnumeric.org/v10.dtd:position "A1"))
               (http://www.gnumeric.org/v10.dtd:Name
                 (http://www.gnumeric.org/v10.dtd:name "Sheet_Title")
                 (http://www.gnumeric.org/v10.dtd:value "\"First Sheet\"")
                 (http://www.gnumeric.org/v10.dtd:value "\"First_Sheet\"")
                 (http://www.gnumeric.org/v10.dtd:position "A1")))
             (http://www.gnumeric.org/v10.dtd:PrintInformation
               (http://www.gnumeric.org/v10.dtd:Margins
                 (http://www.gnumeric.org/v10.dtd:top
                   (@ (PrefUnit "mm") (Points "93.26")))
                 (http://www.gnumeric.org/v10.dtd:bottom
                   (@ (PrefUnit "mm") (Points "93.26")))
376
377
378
379
380
381
382
383

384
385
386
387
388




389
390
391
392
393
394
395
376
377
378
379
380
381
382

383
384




385
386
387
388
389
390
391
392
393
394
395







-
+

-
-
-
-
+
+
+
+







             (http://www.gnumeric.org/v10.dtd:Rows
               (@ (DefaultSizePts "12.1"))
               (http://www.gnumeric.org/v10.dtd:RowInfo
                 (@ (Unit "12.64") (No "0")))
               (http://www.gnumeric.org/v10.dtd:RowInfo
                 (@ (Unit "13.5") (No "1") (Count "17"))))
             (http://www.gnumeric.org/v10.dtd:Selections
               (@ (CursorRow "31") (CursorCol "0"))
               (@ (CursorRow "29") (CursorCol "1"))
               (http://www.gnumeric.org/v10.dtd:Selection
                 (@ (startRow "31")
                    (startCol "0")
                    (endRow "31")
                    (endCol "0"))))
                 (@ (startRow "29")
                    (startCol "1")
                    (endRow "29")
                    (endCol "1"))))
             (http://www.gnumeric.org/v10.dtd:Cells
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "0") (Col "1"))
                 "Time")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "0") (Col "2"))
                 "DeltaTime")
924
925
926
927
928
929
930






















































931
932
933
934
935
936
937
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







               (http://www.gnumeric.org/v10.dtd:paper "na_letter")
               (http://www.gnumeric.org/v10.dtd:comments "in_place")
               (http://www.gnumeric.org/v10.dtd:errors "as_displayed"))
             (http://www.gnumeric.org/v10.dtd:Styles
               (http://www.gnumeric.org/v10.dtd:StyleRegion
                 (@ (startRow "0")
                    (startCol "0")
                    (endRow "65279")
                    (endCol "255"))
                 (http://www.gnumeric.org/v10.dtd:Style
                   (@ (WrapText "0")
                      (VAlign "2")
                      (ShrinkToFit "0")
                      (Shade "0")
                      (Rotation "0")
                      (PatternColor "0:0:0")
                      (Locked "1")
                      (Indent "0")
                      (Hidden "0")
                      (HAlign "1")
                      (Format "General")
                      (Fore "0:0:0")
                      (Back "FFFF:FFFF:FFFF"))
                   (http://www.gnumeric.org/v10.dtd:Font
                     (@ (Unit "10")
                        (Underline "0")
                        (StrikeThrough "0")
                        (Script "0")
                        (Italic "0")
                        (Bold "0"))
                     "Sans")))
               (http://www.gnumeric.org/v10.dtd:StyleRegion
                 (@ (startRow "65280")
                    (startCol "0")
                    (endRow "65534")
                    (endCol "255"))
                 (http://www.gnumeric.org/v10.dtd:Style
                   (@ (WrapText "0")
                      (VAlign "2")
                      (ShrinkToFit "0")
                      (Shade "0")
                      (Rotation "0")
                      (PatternColor "0:0:0")
                      (Locked "1")
                      (Indent "0")
                      (Hidden "0")
                      (HAlign "1")
                      (Format "General")
                      (Fore "0:0:0")
                      (Back "FFFF:FFFF:FFFF"))
                   (http://www.gnumeric.org/v10.dtd:Font
                     (@ (Unit "10")
                        (Underline "0")
                        (StrikeThrough "0")
                        (Script "0")
                        (Italic "0")
                        (Bold "0"))
                     "Sans")))
               (http://www.gnumeric.org/v10.dtd:StyleRegion
                 (@ (startRow "65535")
                    (startCol "0")
                    (endRow "65535")
                    (endCol "255"))
                 (http://www.gnumeric.org/v10.dtd:Style
                   (@ (WrapText "0")
                      (VAlign "2")
                      (ShrinkToFit "0")
                      (Shade "0")
957
958
959
960
961
962
963
964

965
966

967
968

969
970
971

972
973
974
975
976
977

978
979
980

981
982
983

984
985
986

987
988
989

990
991
992

993
994
995







996
997
998
999

1000
1001

1002
1003
1004
1005

1006
1007
1008


1009
1010
1011

1012
1013

1014
1015
1016
1017

1018
1019

1020
1021
1022
1023

1024
1025
1026

1027
1028
1029
1030
1031

1032
1033
1034
1035

1036
1037

1038
1039
1040
1041


1042
1043
1044


1045
1046
1047


1048
1049
1050

1051
1052

1053
1054
1055
1056

1057
1058

1059
1060
1061
1062

1063
1064
1065

1066
1067
1068

1069
1070

1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082

1083
1084
1085

1086
1087
1088

1089
1090
1091

1092
1093
1094

1095
1096
1097

1098
1099
1100

1101
1102
1103
1104
1105
1106
1107
1011
1012
1013
1014
1015
1016
1017

1018
1019

1020
1021

1022
1023
1024

1025



1026
1027

1028
1029
1030

1031
1032
1033

1034
1035
1036

1037
1038
1039

1040
1041
1042

1043
1044
1045

1046
1047
1048
1049
1050
1051
1052
1053
1054
1055

1056
1057

1058
1059
1060
1061

1062
1063


1064
1065
1066
1067

1068
1069

1070
1071
1072
1073

1074
1075

1076
1077
1078
1079

1080
1081
1082

1083
1084
1085
1086
1087

1088
1089
1090
1091

1092
1093

1094
1095
1096


1097
1098
1099


1100
1101
1102


1103
1104
1105
1106

1107
1108

1109
1110
1111
1112

1113
1114

1115
1116
1117
1118

1119
1120
1121

1122
1123
1124

1125
1126

1127
1128
1129
1130






1131
1132

1133
1134
1135

1136
1137
1138

1139
1140
1141

1142
1143
1144

1145
1146
1147

1148
1149
1150

1151
1152
1153
1154
1155
1156
1157
1158







-
+

-
+

-
+


-
+
-
-
-


-
+


-
+


-
+


-
+


-
+


-
+


-
+
+
+
+
+
+
+



-
+

-
+



-
+

-
-
+
+


-
+

-
+



-
+

-
+



-
+


-
+




-
+



-
+

-
+


-
-
+
+

-
-
+
+

-
-
+
+


-
+

-
+



-
+

-
+



-
+


-
+


-
+

-
+



-
-
-
-
-
-


-
+


-
+


-
+


-
+


-
+


-
+


-
+







               (http://www.gnumeric.org/v10.dtd:ColInfo
                 (@ (Unit "64.01") (No "0")))
               (http://www.gnumeric.org/v10.dtd:ColInfo
                 (@ (Unit "48") (No "1") (Count "4"))))
             (http://www.gnumeric.org/v10.dtd:Rows
               (@ (DefaultSizePts "12.1"))
               (http://www.gnumeric.org/v10.dtd:RowInfo
                 (@ (Unit "13.5") (No "0") (Count "21"))))
                 (@ (Unit "13.5") (No "0") (Count "20"))))
             (http://www.gnumeric.org/v10.dtd:Selections
               (@ (CursorRow "1") (CursorCol "0"))
               (@ (CursorRow "4") (CursorCol "4"))
               (http://www.gnumeric.org/v10.dtd:Selection
                 (@ (startRow "1") (startCol "0") (endRow "1") (endCol "0"))))
                 (@ (startRow "4") (startCol "4") (endRow "4") (endCol "4"))))
             (http://www.gnumeric.org/v10.dtd:Cells
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "0") (Col "0"))
                 (@ (ValueType "60") (Row "0") (Col "1"))
                 "This is a title, which has now been edited")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "1") (Col "1"))
                 "A1")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "40") (Row "1") (Col "2"))
                 (@ (ValueType "40") (Row "0") (Col "2"))
                 "2")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "1") (Col "3"))
                 (@ (ValueType "60") (Row "0") (Col "3"))
                 "A1")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "40") (Row "1") (Col "4"))
                 (@ (ValueType "40") (Row "0") (Col "4"))
                 "3")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "2") (Col "0"))
                 (@ (ValueType "60") (Row "1") (Col "0"))
                 "V1")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "2") (Col "1"))
                 (@ (ValueType "60") (Row "1") (Col "1"))
                 "X")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "3") (Col "0"))
                 (@ (ValueType "60") (Row "2") (Col "0"))
                 "V2")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "3") (Col "2"))
                 (@ (ValueType "60") (Row "2") (Col "2"))
                 "X")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "3") (Col "0"))
                 "V3")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "3") (Col "3"))
                 "X")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "4") (Col "0"))
                 "V3")
                 "V4")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "4") (Col "3"))
                 (@ (ValueType "60") (Row "4") (Col "4"))
                 "X")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "5") (Col "0"))
                 "V4")
                 "V5")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "5") (Col "4"))
                 "X")
                 (@ (ValueType "60") (Row "5") (Col "3"))
                 "Y")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "6") (Col "0"))
                 "V5")
                 "V6")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "6") (Col "3"))
                 (@ (ValueType "60") (Row "6") (Col "2"))
                 "Y")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "7") (Col "0"))
                 "V6")
                 "V7")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "7") (Col "2"))
                 (@ (ValueType "60") (Row "7") (Col "1"))
                 "Y")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "8") (Col "0"))
                 "V7")
                 "V8")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "8") (Col "1"))
                 "Y")
                 "Z")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "9") (Col "0"))
                 "V8")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "9") (Col "1"))
                 (@ (ValueType "60") (Row "9") (Col "2"))
                 "Z")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "10") (Col "0"))
                 "V8")
                 "V10")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "10") (Col "2"))
                 (@ (ValueType "60") (Row "10") (Col "3"))
                 "Z")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "11") (Col "0"))
                 "V10")
                 (@ (ValueType "60") (Row "11") (Col "4"))
                 "Z")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "11") (Col "3"))
                 "Z")
                 (@ (ValueType "60") (Row "12") (Col "0"))
                 "V11")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "12") (Col "4"))
                 "Z")
                 (@ (ValueType "60") (Row "12") (Col "3"))
                 "E")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "13") (Col "0"))
                 "V11")
                 "V12")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "13") (Col "3"))
                 (@ (ValueType "60") (Row "13") (Col "2"))
                 "E")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "14") (Col "0"))
                 "V12")
                 "V13")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "14") (Col "2"))
                 (@ (ValueType "60") (Row "14") (Col "1"))
                 "E")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "15") (Col "0"))
                 "V13")
                 "V14")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "15") (Col "1"))
                 "E")
                 "B")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "16") (Col "0"))
                 "V14")
                 "V15")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "16") (Col "1"))
                 (@ (ValueType "60") (Row "16") (Col "2"))
                 "B")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "17") (Col "0"))
                 "V15")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "17") (Col "2"))
                 "B")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "18") (Col "0"))
                 "V16")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "18") (Col "3"))
                 (@ (ValueType "60") (Row "17") (Col "3"))
                 "B")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "19") (Col "4"))
                 (@ (ValueType "60") (Row "18") (Col "4"))
                 "B")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "20") (Col "0"))
                 (@ (ValueType "60") (Row "19") (Col "0"))
                 "V17")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "20") (Col "1"))
                 (@ (ValueType "60") (Row "19") (Col "1"))
                 "-")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "20") (Col "2"))
                 (@ (ValueType "60") (Row "19") (Col "2"))
                 "+")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "20") (Col "3"))
                 (@ (ValueType "60") (Row "19") (Col "3"))
                 "=")
               (http://www.gnumeric.org/v10.dtd:Cell
                 (@ (ValueType "60") (Row "20") (Col "4"))
                 (@ (ValueType "60") (Row "19") (Col "4"))
                 "~"))
             (http://www.gnumeric.org/v10.dtd:SheetLayout (@ (TopLeft "A1")))
             (http://www.gnumeric.org/v10.dtd:Solver
               (@ (ProgramR "0")
                  (ProblemType "0")
                  (NonNeg "1")
                  (ModelType "0")
1215
1216
1217
1218
1219
1220
1221
1222

1266
1267
1268
1269
1270
1271
1272

1273







-
+
                  (ProblemType "0")
                  (NonNeg "1")
                  (ModelType "0")
                  (MaxTime "60")
                  (MaxIter "1000")
                  (Discr "0")
                  (AutoScale "0")))))
         (http://www.gnumeric.org/v10.dtd:UIData (@ (SelectedTab "1")))))
         (http://www.gnumeric.org/v10.dtd:UIData (@ (SelectedTab "0")))))

Modified txtdb/txtdb.scm from [2a05c3812f] to [0fcec95315].

61
62
63
64
65
66
67
68
69
70
71
72
73
74








75
76
77
78
79
80
81
61
62
63
64
65
66
67







68
69
70
71
72
73
74
75
76
77
78
79
80
81
82







-
-
-
-
-
-
-
+
+
+
+
+
+
+
+







		     #f))
	       dat)))

(define (string->safe-filename str)
  (string-substitute (regexp " ") "_" str #t))

(define (sheet->txtdb dat targdir)
  (let ((sheet-name  (string->safe-filename (car (find-section dat 'http://www.gnumeric.org/v10.dtd:Name))))
	(cells       (find-section dat 'http://www.gnumeric.org/v10.dtd:Cells))
	(remaining   (remove-section (remove-section dat 'http://www.gnumeric.org/v10.dtd:Name)
				     'http://www.gnumeric.org/v10.dtd:Cells))
	(rownums     (make-hash-table))  ;; num -> name
	(colnums     (make-hash-table))  ;; num -> name
	(cols        (make-hash-table))) ;; name -> ( (name val) ... )
  (let* ((sheet-name  (car (find-section dat 'http://www.gnumeric.org/v10.dtd:Name)))
	 ;; (safe-name   (string->safe-filename sheet-name))
	 (cells       (find-section dat 'http://www.gnumeric.org/v10.dtd:Cells))
	 (remaining   (remove-section (remove-section dat 'http://www.gnumeric.org/v10.dtd:Name)
				      'http://www.gnumeric.org/v10.dtd:Cells))
	 (rownums     (make-hash-table))  ;; num -> name
	 (colnums     (make-hash-table))  ;; num -> name
	 (cols        (make-hash-table))) ;; name -> ( (name val) ... )
    (for-each (lambda (cell)
		(let ((rownum  (string->number (car (find-section cell 'Row))))
		      (colnum  (string->number (car (find-section cell 'Col))))
		      (valtype (let ((res (find-section cell 'ValueType)))
				 (if res (car res) #f)))
		      (value   (let ((res (cdr (filter (lambda (x)(not (list? x))) cell))))
				 (if (null? res) "" (car res)))))
221
222
223
224
225
226
227

228
229
230
231
232
233
234
235
236
237
238











239
240
241
242
243
244
245
246
247

248
249



250
251
252

253
254



255
256
257
258
259
260
261
222
223
224
225
226
227
228
229











230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250


251
252
253
254
255
256
257


258
259
260
261
262
263
264
265
266
267







+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+









+
-
-
+
+
+



+
-
-
+
+
+







   (else '(ValueType "60"))))

(define (dat->cells dat)
  (let* ((indx     (common:sparse-list-generate-index dat))
	 (row-indx (car indx))
	 (col-indx (cadr indx))
	 (exprs    (make-hash-table)))
    (list (cons 'http://www.gnumeric.org/v10.dtd:Cells 
    (map (lambda (item)
	   (let* ((row-name (car item))
		  (col-name (cadr item))
		  (row-num  (cadr (assoc row-name row-indx)))
		  (col-num  (cadr (assoc col-name col-indx)))
		  (value    (caddr item))
		  (val-type (get-value-type value exprs)))
	     (list 'http://www.gnumeric.org/v10.dtd:Cell
		   (list '@ val-type (list 'Row (conc row-num)) (list 'Col (conc col-num)))
		   value)))
	 dat)))
		(map (lambda (item)
		       (let* ((row-name (car item))
			      (col-name (cadr item))
			      (row-num  (cadr (assoc row-name row-indx)))
			      (col-num  (cadr (assoc col-name col-indx)))
			      (value    (caddr item))
			      (val-type (get-value-type value exprs)))
			 (list 'http://www.gnumeric.org/v10.dtd:Cell
			       (list '@ val-type (list 'Row (conc row-num)) (list 'Col (conc col-num)))
			       value)))
		     dat)))))
    
(define (txtdb->sxml dbdir)
  (let* ((sht-names (read-file (conc dbdir "/sheet-names.cfg")  read-line))
	 (wrk-rem   (file->sxml (conc dbdir "/sxml/workbook.sxml")))
	 (sht-rem   (file->sxml (conc dbdir "/sxml/sheets.sxml")))
	 (sheets    (fold (lambda (sheetname res)
			    (let* ((sheetdat (read-dat (conc dbdir "/" sheetname ".dat")))
				   (cells    (dat->cells sheetdat))
				   (sht-meta (file->sxml (conc dbdir "/sxml/" sheetname ".sxml"))))
			      (cons (cons (car sht-meta) 
			      (cons (append (append sht-meta (list (list 'http://www.gnumeric.org/v10.dtd:Name sheetname)))
					    cells)
					  (append (cons (list 'http://www.gnumeric.org/v10.dtd:Name sheetname)
							(cdr sht-meta))
						  cells))
				    res)))
			  '()
			  sht-names)))
    (append wrk-rem (list (append
    (append wrk-rem (list (cons 'http://www.gnumeric.org/v10.dtd:Workbook 
				(list (cons 'http://www.gnumeric.org/v10.dtd:Sheets sheets)))))))
			   (cons 'http://www.gnumeric.org/v10.dtd:Workbook
				 sht-rem)
			   (list (cons 'http://www.gnumeric.org/v10.dtd:Sheets sheets)))))))

;; (define (

;; 
;; optional apply proc to rownum colnum value
;; 
;; NB// If a change is made to this routine please look also at applying