Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
convert lispreader submodule to folder
Signed-off-by: TasMania17 <uniquecomp@bigpond.com>
- Loading branch information
1 parent
e30d0f4
commit b6855f7
Showing
20 changed files
with
3,426 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# $Id: Makefile 933 2007-03-18 14:22:54Z schani $ | ||
|
||
VERSION = 0.5 | ||
|
||
all : liblispreader.a | ||
|
||
liblispreader.a : | ||
$(MAKE) -f Makefile.dist | ||
|
||
dist : | ||
rm -rf lispreader-$(VERSION) | ||
mkdir lispreader-$(VERSION) | ||
mkdir lispreader-$(VERSION)/doc | ||
cp README COPYING NEWS lispreader-$(VERSION)/ | ||
cp -pr lispreader.[ch] lispscan.h allocator.[ch] pools.[ch] docexample.c lispcat.c lispreader-$(VERSION)/ | ||
cp Makefile.dist lispreader-$(VERSION)/Makefile | ||
cp doc/{lispreader,version}.texi lispreader-$(VERSION)/doc/ | ||
cp doc/Makefile lispreader-$(VERSION)/doc/ | ||
make -C lispreader-$(VERSION)/doc/ | ||
tar -zcvf lispreader-$(VERSION).tar.gz lispreader-$(VERSION) | ||
rm -rf lispreader-$(VERSION) | ||
|
||
clean : | ||
rm -f *~ | ||
$(MAKE) -f Makefile.dist clean | ||
$(MAKE) -C doc clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- makefile -*- | ||
# $Id: Makefile.dist 933 2007-03-18 14:22:54Z schani $ | ||
|
||
CC=gcc | ||
CFLAGS=-Wall -O2 | ||
ALL_CFLAGS=$(CFLAGS) -I. | ||
|
||
LISPREADER_OBJS = lispreader.o allocator.o pools.o | ||
|
||
all : liblispreader.a | ||
|
||
liblispreader.a : $(LISPREADER_OBJS) | ||
ar rcu liblispreader.a $(LISPREADER_OBJS) | ||
|
||
docexample : docexample.o $(LISPREADER_OBJS) | ||
$(CC) -Wall -g -o docexample $(LISPREADER_OBJS) docexample.o `pkg-config --libs glib-2.0` | ||
|
||
lispcat : lispcat.o $(LISPREADER_OBJS) | ||
$(CC) -Wall -g -o lispcat $(LISPREADER_OBJS) lispcat.o `pkg-config --libs glib-2.0` | ||
|
||
#comment-test: comment-test.o $(LISPREADER_OBJS) | ||
# $(CC) -Wall -g -o comment-test $(LISPREADER_OBJS) comment-test.o | ||
|
||
%.o : %.c | ||
$(CC) $(ALL_CFLAGS) `pkg-config --cflags glib-2.0` -c $< | ||
|
||
clean : | ||
rm -f liblispreader.a docexample *.o *~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
News | ||
**** | ||
|
||
0.5 | ||
=== | ||
|
||
* #?(number) pattern | ||
|
||
* lisp_free can handly arbitrarily nested lists without | ||
recursion. | ||
|
||
* Memory allocation can now be controlled with the allocator | ||
interface. | ||
|
||
* An allocator is included which is very fast and low-overhead, | ||
but only allows freeing all data at once. | ||
|
||
* A new memory mapping Lisp stream type is implemented, which | ||
about doubles parsing speed. | ||
|
||
0.4 | ||
=== | ||
|
||
* Functions for making expressions (contributed by Masatake Yamato) | ||
|
||
* Type predicates (contributed by Masatake Yamato) | ||
|
||
* lisp_cxr | ||
|
||
0.3 | ||
=== | ||
|
||
* Lisp style comments are ignored (strings starting with | ||
the semicolon, ended by newline, contributed by Masatake Yamato) | ||
|
||
* Used-defined streams (contributed by Masatake Yamato) | ||
|
||
0.2 | ||
=== | ||
|
||
* Added code for handling real numbers (contributed by Masatake | ||
Yamato) | ||
|
||
* The string arguments to lisp_read_from_string and | ||
lisp_match_string are now const |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
lispreader 0.5 | ||
============== | ||
|
||
lispreader is a small library for reading expressions in Lisp | ||
syntax. It has originally been written to facilitate simple exchange | ||
of structured data between processes but its main purpose is now to | ||
provide a framework for reading configuration files. To simplify | ||
interpretation of the read data, lispreader also provides functions | ||
for simple matching of expressions against patterns. | ||
|
||
lispreader is also used in at least one application to read and write | ||
data files. Lisp syntax is very suitable for doing this, especially if | ||
the data is organized hierachically. | ||
|
||
|
||
Documentation | ||
------------- | ||
|
||
A reference manual for lispreader is included in the distribution in | ||
texinfo, info and html formats. | ||
|
||
|
||
Platforms | ||
--------- | ||
|
||
lispreader has been tested on GNU/Linux i386 and MacOS X PPC systems, | ||
but should work on any system with an ANSI C compliant | ||
compiler/library pair. | ||
|
||
|
||
Licence and Availability | ||
------------------------ | ||
|
||
lispreader is distributed under the terms of the GNU General Public | ||
Licence. | ||
|
||
The source of lispreader is available at the lispreader homepage at | ||
|
||
http://www.complang.tuwien.ac.at/schani/lispreader/ | ||
|
||
|
||
--- | ||
Mark Probst | ||
schani@complang.tuwien.ac.at |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
locale-neutral float conversion via GLib (g_ascii_strtod/dtostr). | ||
change float to double in real. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* allocator.c | ||
* | ||
* lispreader | ||
* | ||
* Copyright (C) 2004 Mark Probst | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public | ||
* License along with this library; if not, write to the | ||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#include <allocator.h> | ||
|
||
#include <stdlib.h> | ||
#include <string.h> | ||
|
||
static void* | ||
malloc_allocator_alloc (void *allocator_data, size_t size) | ||
{ | ||
return malloc(size); | ||
} | ||
|
||
static void | ||
malloc_allocator_free (void *allocator_data, void *chunk) | ||
{ | ||
free(chunk); | ||
} | ||
|
||
allocator_t malloc_allocator = { malloc_allocator_alloc, malloc_allocator_free, 0 }; | ||
|
||
static void | ||
pools_allocator_free (void *allocator_data, void *chunk) | ||
{ | ||
} | ||
|
||
void | ||
init_pools_allocator (allocator_t *allocator, pools_t *pools) | ||
{ | ||
allocator->alloc = (void* (*) (void*, size_t))pools_alloc; | ||
allocator->free = pools_allocator_free; | ||
allocator->allocator_data = pools; | ||
} | ||
|
||
char* | ||
allocator_strdup (allocator_t *allocator, const char *str) | ||
{ | ||
size_t len = strlen(str) + 1; | ||
char *copy = (char*)allocator_alloc(allocator, len); | ||
|
||
if (copy != 0) | ||
memcpy(copy, str, len); | ||
|
||
return copy; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* allocator.h | ||
* | ||
* lispreader | ||
* | ||
* Copyright (C) 2004-2007 Mark Probst | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public | ||
* License along with this library; if not, write to the | ||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#ifndef __ALLOCATOR_H__ | ||
#define __ALLOCATOR_H__ | ||
|
||
#include <stdlib.h> | ||
|
||
#include "pools.h" | ||
|
||
typedef struct | ||
{ | ||
void* (*alloc) (void *allocator_data, size_t size); | ||
void (*free) (void *allocator_data, void *chunk); | ||
void *allocator_data; | ||
} allocator_t; | ||
|
||
extern allocator_t malloc_allocator; | ||
|
||
void init_pools_allocator (allocator_t *allocator, pools_t *pools); | ||
|
||
#define allocator_alloc(a,s) ((a)->alloc((a)->allocator_data, (s))) | ||
#define allocator_free(a,c) ((a)->free((a)->allocator_data, (c))) | ||
|
||
char* allocator_strdup (allocator_t *allocator, const char *str); | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* $Id: comment-test.c 187 2000-07-09 21:08:28Z schani $ */ | ||
/* | ||
* comment_test.c | ||
* | ||
* Copyright (C) 2000 Masatake YAMATO <jet@gyve.org> | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU Library General Public | ||
* License as published by the Free Software Foundation; either | ||
* version 2 of the License, or (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
* Library General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Library General Public | ||
* License along with this library; if not, write to the | ||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
* Boston, MA 02111-1307, USA. | ||
*/ | ||
|
||
#include <lispreader.h> | ||
|
||
int | ||
main (void) | ||
{ | ||
char * script = | ||
"; This is comments(1)\n" | ||
"\"This is script (1)\"\n" | ||
"; This is comments(2)\n" | ||
"\"This is script (2)\"\n" | ||
"; This is comments(3)" ; | ||
|
||
lisp_object_t *obj; | ||
lisp_stream_t stream; | ||
|
||
if (NULL == lisp_stream_init_string(&stream, script)) | ||
{ | ||
fprintf(stderr, "Fail in lisp_stream_init_string\n"); | ||
return 1; | ||
} | ||
|
||
while (1) | ||
{ | ||
int type; | ||
|
||
obj = lisp_read(&stream); | ||
|
||
type = lisp_type(obj); | ||
|
||
if (type == LISP_TYPE_STRING) | ||
{ | ||
fprintf(stderr, "->%s\n", lisp_string(obj)); | ||
lisp_free(obj); | ||
} | ||
else if (type == LISP_TYPE_PARSE_ERROR) | ||
{ | ||
printf("parse error\n"); | ||
lisp_free(obj); | ||
} | ||
else if (type == LISP_TYPE_EOF) | ||
{ | ||
printf ("eof\n"); | ||
lisp_free(obj); | ||
break; | ||
} | ||
else | ||
printf ("wrong type\n"); | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# $Id: Makefile 182 1999-12-21 16:55:25Z schani $ | ||
|
||
all : html info | ||
|
||
html : lispreader_toc.html | ||
|
||
info : lispreader.info | ||
|
||
lispreader_toc.html : lispreader.texi | ||
texi2html -expandinfo lispreader.texi | ||
|
||
lispreader.info : lispreader.texi | ||
makeinfo lispreader.texi | ||
|
||
clean : | ||
rm -f lispreader*.html lispreader.info *~ |
Oops, something went wrong.