Permalink
Browse files

Initial commit

  • Loading branch information...
jvirtanen committed Apr 18, 2012
0 parents commit 249f711f053f4bbc69acc02befdd628110a79e1a
Showing with 1,541 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +19 −0 LICENSE
  3. +40 −0 Makefile
  4. +54 −0 README.md
  5. +788 −0 src/sheets.c
  6. +258 −0 src/sheets.h
  7. +212 −0 test/dump.c
  8. +36 −0 test/dump.py
  9. +28 −0 test/support.py
  10. +103 −0 test/test.py
@@ -0,0 +1,3 @@
+*.o
+*.pyc
+/test/dump
19 LICENSE
@@ -0,0 +1,19 @@
+Copyright (c) 2012 Jussi Virtanen
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
@@ -0,0 +1,40 @@
+CC ?= gcc
+LD := $(CC)
+
+PYTHON ?= python
+
+CFLAGS += -Isrc
+CFLAGS += -O3
+CFLAGS += -Wall
+CFLAGS += -Wextra
+CFLAGS += -pedantic
+CFLAGS += -std=c99
+
+OBJS += src/sheets.o
+OBJS += test/dump.o
+PROG := test/dump
+
+E := @echo
+Q := @
+
+all: test
+.PHONY: all
+
+clean:
+ $(E) " CLEAN "
+ $(Q) rm -f $(OBJS) $(PROG)
+ $(Q) find . -name *.pyc | xargs rm -f
+.PHONY: clean
+
+test: $(PROG)
+ $(E) " TEST "
+ $(Q) cd test; $(PYTHON) test.py
+.PHONY: test
+
+$(PROG): $(OBJS)
+ $(E) " LINK " $@
+ $(Q) $(LD) $(LDFLAGS) -o $@ $^
+
+%.o: %.c
+ $(E) " COMPILE " $@
+ $(Q) $(CC) $(CFLAGS) -c -o $@ $<
@@ -0,0 +1,54 @@
+Sheets
+======
+
+Sheets is a simple and fast C library for reading tabular text formats, such
+as CSV and TSV.
+
+
+Features
+--------
+
+ - Quoted fields
+
+ - Simple API
+
+ - Zero dependencies
+
+ - Liberal license
+
+
+Usage
+-----
+
+ file = fopen("example.csv", "rb");
+
+ reader = sheets_read_file(file, &sheets_csv);
+ record = sheets_record_alloc(&sheets_csv);
+
+ while (sheets_reader_read(reader, record) == 0) {
+ for (unsigned i = 0; i < sheets_record_size(record); i++) {
+ sheets_record_field(record, i, &field);
+ puts(field.value);
+ }
+ }
+
+See `src/sheets.h` for reference documentation.
+
+
+Installation
+------------
+
+Include `src/sheets.c` and `src/sheets.h` into your application.
+
+
+History
+-------
+
+ - 0.1.0 (2012-04-18)
+ - Initial release
+
+
+License
+-------
+
+Sheets is released under the MIT License. See `LICENSE` for details.
Oops, something went wrong.

0 comments on commit 249f711

Please sign in to comment.