summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoragc <agc>2012-04-27 04:48:44 +0000
committeragc <agc>2012-04-27 04:48:44 +0000
commit8787d788b740be70e72f307ecfc0d67d8a6bf4ae (patch)
tree39e49c149bc75cbd6a5750f780e8225dfaa41933
parentc366411c3879a088da09bf2acd1700c5a4365366 (diff)
downloadpkgsrc-8787d788b740be70e72f307ecfc0d67d8a6bf4ae.tar.gz
Initial import of picoc-2.1 into the Packages Collection
PicoC is a very small C interpreter for scripting. It was originally written as the script language for a UAV's on-board flight system. It's also very suitable for other robotic, embedded and non-embedded applications. The core C source code is around 4000 lines of code. It's not intended to be a complete implementation of ISO C but it has all the essentials. When compiled it only takes a few k of code space and is also very sparing of data space. This means it can work well in small embedded devices. It's also a fun example of how to create a very small language implementation while still keeping the code readable. picoc has been tested on x86-32, x86-64, powerpc, arm, ultrasparc, HP-PA and blackfin processors and is easy to port to new targets. To show it working on the old DECUS grep program (included as one of its tests): % time picoc work/picoc/tests/46_grep.c - case work/picoc/tests/46_grep.c File work/picoc/tests/46_grep.c: "lower-case are always ignored. Blank lines never match. The expression", case '^': case '$': case '.': case '[': case ':': ... 0.651u 0.000s 0:00.68 95.5% 0+0k 0+0io 0pf+0w % wc work/picoc/tests/46_grep.c 557 1991 15172 work/picoc/tests/46_grep.c %
-rw-r--r--lang/picoc/DESCR14
-rw-r--r--lang/picoc/Makefile23
-rw-r--r--lang/picoc/PLIST2
-rw-r--r--lang/picoc/distinfo9
-rw-r--r--lang/picoc/patches/patch-aa16
-rw-r--r--lang/picoc/patches/patch-ab15
-rw-r--r--lang/picoc/patches/patch-ac18
-rw-r--r--lang/picoc/patches/patch-ad78
8 files changed, 175 insertions, 0 deletions
diff --git a/lang/picoc/DESCR b/lang/picoc/DESCR
new file mode 100644
index 00000000000..94020c0379e
--- /dev/null
+++ b/lang/picoc/DESCR
@@ -0,0 +1,14 @@
+PicoC is a very small C interpreter for scripting. It was originally
+written as the script language for a UAV's on-board flight system.
+It's also very suitable for other robotic, embedded and non-embedded
+applications.
+
+The core C source code is around 4000 lines of code. It's not
+intended to be a complete implementation of ISO C but it has all the
+essentials. When compiled it only takes a few k of code space and is
+also very sparing of data space. This means it can work well in small
+embedded devices. It's also a fun example of how to create a very
+small language implementation while still keeping the code readable.
+
+picoc has been tested on x86-32, x86-64, powerpc, arm, ultrasparc,
+HP-PA and blackfin processors and is easy to port to new targets.
diff --git a/lang/picoc/Makefile b/lang/picoc/Makefile
new file mode 100644
index 00000000000..01744350e2f
--- /dev/null
+++ b/lang/picoc/Makefile
@@ -0,0 +1,23 @@
+# $NetBSD: Makefile,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+DISTNAME= picoc-2.1
+CATEGORIES= lang
+MASTER_SITES= http://picoc.googlecode.com/files/
+EXTRACT_SUFX= .tar.bz2
+
+MAINTAINER= agc@NetBSD.org
+HOMEPAGE= http://code.google.com/p/picoc/
+COMMENT= C interpreter
+LICENSE= modified-bsd
+
+WRKSRC= ${WRKDIR}/picoc
+
+PKG_DESTDIR_SUPPORT= user-destdir
+AUTO_MKDIRS= yes
+
+do-install:
+ ${INSTALL_PROGRAM} ${WRKSRC}/picoc ${DESTDIR}${PREFIX}/bin/picoc
+
+.include "../../devel/readline/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/lang/picoc/PLIST b/lang/picoc/PLIST
new file mode 100644
index 00000000000..3407bf96d0c
--- /dev/null
+++ b/lang/picoc/PLIST
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+bin/picoc
diff --git a/lang/picoc/distinfo b/lang/picoc/distinfo
new file mode 100644
index 00000000000..aaeb3275d18
--- /dev/null
+++ b/lang/picoc/distinfo
@@ -0,0 +1,9 @@
+$NetBSD: distinfo,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+SHA1 (picoc-2.1.tar.bz2) = 24fdc3c8302915d663fcaefaf878ab5ad5a2d69b
+RMD160 (picoc-2.1.tar.bz2) = 9d65bcee54a6d7fa28a66afdd09d3b7554315f68
+Size (picoc-2.1.tar.bz2) = 69991 bytes
+SHA1 (patch-aa) = 68819805ddc79a193df17ba2d23fbf388f7bfcd1
+SHA1 (patch-ab) = 616fb42d4bc08f4500d607e33ece112e87ecdd0b
+SHA1 (patch-ac) = 879e978d0f2542e5841d5279aa034ec4a7209147
+SHA1 (patch-ad) = e976c920fa6807ab773f6c505e88a5b3ed7e990a
diff --git a/lang/picoc/patches/patch-aa b/lang/picoc/patches/patch-aa
new file mode 100644
index 00000000000..8ce57ac67b9
--- /dev/null
+++ b/lang/picoc/patches/patch-aa
@@ -0,0 +1,16 @@
+$NetBSD: patch-aa,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+avoid macro fun with cpp definition
+
+--- cstdlib/stdio.c 2012/04/26 12:20:00 1.1
++++ cstdlib/stdio.c 2012/04/26 12:21:03
+@@ -414,7 +414,8 @@
+
+ void StdioFileno(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
+ {
+- ReturnValue->Val->Integer = fileno(Param[0]->Val->Pointer);
++ FILE *fp = (FILE *)Param[0]->Val->Pointer;
++ ReturnValue->Val->Integer = fileno(fp);
+ }
+
+ void StdioFflush(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
diff --git a/lang/picoc/patches/patch-ab b/lang/picoc/patches/patch-ab
new file mode 100644
index 00000000000..d7a57263d01
--- /dev/null
+++ b/lang/picoc/patches/patch-ab
@@ -0,0 +1,15 @@
+$NetBSD: patch-ab,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+hardcode the Hz value
+
+--- cstdlib/time.c 2012/04/26 12:20:00 1.1
++++ cstdlib/time.c 2012/04/26 12:21:03
+@@ -11,7 +11,7 @@
+ #endif
+
+ #ifdef CLK_TCK
+-static int CLK_TCKValue = CLK_TCK;
++static int CLK_TCKValue = 100;
+ #endif
+
+ void StdAsctime(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
diff --git a/lang/picoc/patches/patch-ac b/lang/picoc/patches/patch-ac
new file mode 100644
index 00000000000..bcffd9f31a0
--- /dev/null
+++ b/lang/picoc/patches/patch-ac
@@ -0,0 +1,18 @@
+$NetBSD: patch-ac,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+use the correct number of args to setpgrp()
+
+--- cstdlib/unistd.c 2012/04/26 12:20:00 1.1
++++ cstdlib/unistd.c 2012/04/26 12:21:03
+@@ -278,7 +278,11 @@
+
+ void UnistdSetpgrp(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
+ {
++#ifdef __linux__
+ ReturnValue->Val->Integer = setpgrp();
++#else
++ ReturnValue->Val->Integer = setpgrp(Param[0]->Val->Integer, Param[1]->Val->Integer);
++#endif
+ }
+
+ void UnistdSetregid(struct ParseState *Parser, struct Value *ReturnValue, struct Value **Param, int NumArgs)
diff --git a/lang/picoc/patches/patch-ad b/lang/picoc/patches/patch-ad
new file mode 100644
index 00000000000..7f402969e32
--- /dev/null
+++ b/lang/picoc/patches/patch-ad
@@ -0,0 +1,78 @@
+$NetBSD: patch-ad,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+
+Use a better (BSD) Makefile
+
+--- Makefile 2012/04/26 13:04:31 1.1
++++ Makefile 2012/04/26 13:04:39
+@@ -1,55 +1,18 @@
+-CC=gcc
+-CFLAGS=-Wall -pedantic -g -DUNIX_HOST
+-LIBS=-lm -lreadline
++PROG=picoc
++CPPFLAGS+= -DUNIX_HOST
++LDADD+=-lm -ledit
++# interpreter source
++SRCS= picoc.c table.c lex.c parse.c expression.c heap.c type.c
++SRCS+= variable.c clibrary.c platform.c include.c
++# platform
++SRCS+= platform_unix.c library_unix.c
++# cstdlib
++SRCS+= stdio.c math.c string.c stdlib.c
++SRCS+= time.c errno.c ctype.c stdbool.c
++SRCS+= unistd.c
++MKMAN=no
++WARNS=0
+
+-TARGET = picoc
+-SRCS = picoc.c table.c lex.c parse.c expression.c heap.c type.c \
+- variable.c clibrary.c platform.c include.c \
+- platform/platform_unix.c platform/library_unix.c \
+- cstdlib/stdio.c cstdlib/math.c cstdlib/string.c cstdlib/stdlib.c \
+- cstdlib/time.c cstdlib/errno.c cstdlib/ctype.c cstdlib/stdbool.c \
+- cstdlib/unistd.c
+-OBJS := $(SRCS:%.c=%.o)
++.PATH: ${.CURDIR} ${.CURDIR}/cstdlib ${.CURDIR}/platform
+
+-all: $(TARGET)
+-
+-$(TARGET): $(OBJS)
+- $(CC) $(CFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
+-
+-test: all
+- (cd tests; make test)
+-
+-clean:
+- rm -f $(TARGET) $(OBJS) *~
+-
+-count:
+- @echo "Core:"
+- @cat picoc.h interpreter.h picoc.c table.c lex.c parse.c expression.c platform.c heap.c type.c variable.c include.c | grep -v '^[ ]*/\*' | grep -v '^[ ]*$$' | wc
+- @echo ""
+- @echo "Everything:"
+- @cat $(SRCS) *.h */*.h | wc
+-
+-.PHONY: clibrary.c
+-
+-picoc.o: picoc.c picoc.h
+-table.o: table.c interpreter.h platform.h
+-lex.o: lex.c interpreter.h platform.h
+-parse.o: parse.c picoc.h interpreter.h platform.h
+-expression.o: expression.c interpreter.h platform.h
+-heap.o: heap.c interpreter.h platform.h
+-type.o: type.c interpreter.h platform.h
+-variable.o: variable.c interpreter.h platform.h
+-clibrary.o: clibrary.c picoc.h interpreter.h platform.h
+-platform.o: platform.c picoc.h interpreter.h platform.h
+-include.o: include.c picoc.h interpreter.h platform.h
+-platform/platform_unix.o: platform/platform_unix.c picoc.h interpreter.h platform.h
+-platform/library_unix.o: platform/library_unix.c interpreter.h platform.h
+-cstdlib/stdio.o: cstdlib/stdio.c interpreter.h platform.h
+-cstdlib/math.o: cstdlib/math.c interpreter.h platform.h
+-cstdlib/string.o: cstdlib/string.c interpreter.h platform.h
+-cstdlib/stdlib.o: cstdlib/stdlib.c interpreter.h platform.h
+-cstdlib/time.o: cstdlib/time.c interpreter.h platform.h
+-cstdlib/errno.o: cstdlib/errno.c interpreter.h platform.h
+-cstdlib/ctype.o: cstdlib/ctype.c interpreter.h platform.h
+-cstdlib/stdbool.o: cstdlib/stdbool.c interpreter.h platform.h
+-cstdlib/unistd.o: cstdlib/unistd.c interpreter.h platform.h
++.include <bsd.prog.mk>