Compare commits

...

10 Commits

55
.gitignore vendored

@ -1,58 +1,5 @@
config.h.in
obj/*
*.so
*.o
.deps
.libs
autom4te.cache
config.h
*.doc
*.x
*.lo
*.la
aclocal.m4
depcomp
mdate-sh
texinfo.tex
.#*
*~
,*
aclocal.m4
confdefs.h
config.build-subdirs
config.cache
config.h
config.status
conftest
conftest.c
depcomp
ltconfig
mdate-sh
mkinstalldirs
stamp-h1
*.go
cscope.out
cscope.files
*.log
*.aux
*.cp
*.cps
*.dvi
*.fn
*.fns
*.ky
*.pg
*.toc
*.tp
*.vr
*.tps
*.vrs
*.pgs
*.rn
*.rns
*.scan
*.d
version.scm
*.m4
ltmain.sh
libtool
env

@ -1,3 +1,3 @@
This csv reader is originally wrote by Andy Wingo <wingo at pobox dot com>
Modified and maintained by Nala Ginrut <nalaginrut@gmail.com>
Further modified for use by Brady McDonough <me at bradymcd dot ca>
Further modified for use by Brady McDonough <echo bWVAYnJhZHltY2QuY2EK | base64 -d>

@ -0,0 +1,6 @@
This is an index of all major changes from the original at (https://gitlab.com/NalaGinrut/guile-csv)/
- Added a csv->sxml procedure
- Added an optional argument #:record-sym to both (csv->sxml) and (csv->xml)
- Rewrote the Makefile to install to the site directory
- Added a pre-compile step to `make install` to be friendly-er to multi-user setups and REPL users

@ -6,12 +6,20 @@ OBJ := csv.go
all: $(OBJ)
%.go: csv/%.scm
GUILE_AUTO_COMPILE=0 guild compile $< -o $@
@GUILE_AUTO_COMPILE=0 guild compile $< -o $@
install:
install: $(TARGET)/csv $(CCACHE)/csv
$(TARGET)/csv:
@echo "Installing source..."
cp -fr csv/ $(TARGET)
@echo "Install complete."
$(CCACHE)/csv:
@echo "Installing objects to cache..."
mkdir -p $(CCACHE)/csv/
cp -fr *.go $(CCACHE)/csv/
@echo "Cache complete."
uninstall:
rm -fr $(TARGET)/csv

@ -72,4 +72,4 @@ breath). If anyone reading this does want such functionality and has a
description of how they think the function ought to act please do raise an
issue.
[og-repo]:(https://gitlab.com/NalaGinrut/guile-csv)
[og-repo]:https://gitlab.com/NalaGinrut/guile-csv

@ -1,7 +1,8 @@
;; guile-csv
;; Copyright (C) 2008, 2012, 2013
;; Copyright (C) 2008, 2012, 2013, 2021
;; Andy Wingo <wingo at pobox dot com>
;; Nala Ginrut <nalaginrut@gmail.com>
;; Brady McDonough
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU Lesser General Public License as
@ -36,13 +37,17 @@
(define (finish-cell b seed)
(have-cell (list->string (reverse b)) seed))
(define (next-cell b seed)
(state-init (!) (finish-cell b seed)))
(state-finish-cell (!) (finish-cell b seed)))
(define (state-init c seed)
(cond ((eqv? c delimiter) (state-init (!) (have-cell "" seed)))
((eqv? c #\") (state-string (!) '() seed))
((eqv? c #\newline) seed)
((eqv? c #\newline) (have-cell "" seed))
((eof-object? c) seed)
(else (state-any c '() seed))))
(define (state-finish-cell c seed)
(cond ((eqv? c #\newline) seed)
((eof-object? c) seed)
(else (state-init c seed))))
(define (state-string c b seed)
(cond ((eqv? c #\") (state-string-quote (!) b seed))
((eof-object? c) (error "Open double-quoted string" (list->string (reverse b))))

Loading…
Cancel
Save