Megatest

Check-in [93afeeb4bd]
Login
Overview
Comment:Added full import from gnumeric format and a stub for reading from txtdb
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | dev
Files: files | file ages | folders
SHA1: 93afeeb4bdbd9933d4311625ed1e136b8d33b965
User & Date: matt on 2013-07-14 03:56:47
Other Links: branch diff | manifest | tags
Context
2013-07-14
10:58
First pass at txtdb reader check-in: f1295e0ec5 user: matt tags: dev
03:56
Added full import from gnumeric format and a stub for reading from txtdb check-in: 93afeeb4bd user: matt tags: dev
03:26
Converted to using xml instead of using sxml in the stored meta files for txtdb check-in: 59fcabaf30 user: matt tags: dev
Changes

Modified txtdb/txtdb.scm from [edae8fdba8] to [5e94ada62d].

133
134
135
136
137
138
139
































140
141
142
143
144
145
146
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178







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







	(print (sxml-serializer#serialize-sxml sht-rem))))
    (let ((sheet-names (map (lambda (sheet)
			      (sheet->txtdb sheet targdir))
			    sheets)))
      (with-output-to-file (conc targdir "/sheet-names.cfg")
	(lambda ()
	  (map print sheet-names))))))

(define (read-gnumeric-file fname)
  (if (not (string-match (regexp ".*.gnumeric$") fname))
      (begin
	(print "ERROR: Attempt to import gnumeric file with extention other than .gnumeric")
	(exit))
      (let ((tmpf (create-temporary-file (pathname-strip-directory fname))))
	(system (conc " gunzip > " tmpf " < " fname))
	(let ((res (txtdb:read-gnumeric-xml tmpf)))
	  (delete-file tmpf)
	  res))))

(define (import-gnumeric-file fname targdir)
  (extract-txtdb (read-gnumeric-file fname) targdir))

(define (txtdb-export dbdir fname)
  (let ((sxml-dat (txtdb->sxml dbdir))
	(tmpf     (create-temporary-file (pathname-strip-directory fname))))
    (with-output-to-file tmpf
      (lambda ()
	(print (sxml-serializer#serialize-sxml sxml-dat))))
    (system (conc "gzip " tmpf))
    (file-copy tmpf fname)
    (delete-file tmpf)))
    
(define (txtdb->sxml dbdir)
  ;; Read sheets list
  ;; Read sheets
  ;; Read xml for each sheet
  ;; Read meta data xml
  ;; Construct the final sxml and return it
  #f)

#|  
 (define x (txtdb:read-gnumeric-xml "testdata-stripped.xml"))



;; Write out sxml