pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/picoc Initial import of picoc-2.1 into the Packag...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/81926f5cf56c
branches:  trunk
changeset: 603037:81926f5cf56c
user:      agc <agc%pkgsrc.org@localhost>
date:      Fri Apr 27 04:48:44 2012 +0000

description:
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
        %

diffstat:

 lang/picoc/DESCR            |  14 ++++++++
 lang/picoc/Makefile         |  23 +++++++++++++
 lang/picoc/PLIST            |   2 +
 lang/picoc/distinfo         |   9 +++++
 lang/picoc/patches/patch-aa |  16 +++++++++
 lang/picoc/patches/patch-ab |  15 ++++++++
 lang/picoc/patches/patch-ac |  18 ++++++++++
 lang/picoc/patches/patch-ad |  78 +++++++++++++++++++++++++++++++++++++++++++++
 8 files changed, 175 insertions(+), 0 deletions(-)

diffs (207 lines):

diff -r d1a07daa3233 -r 81926f5cf56c lang/picoc/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/DESCR  Fri Apr 27 04:48:44 2012 +0000
@@ -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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/Makefile       Fri Apr 27 04:48:44 2012 +0000
@@ -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@localhost
+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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/PLIST  Fri Apr 27 04:48:44 2012 +0000
@@ -0,0 +1,2 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2012/04/27 04:48:44 agc Exp $
+bin/picoc
diff -r d1a07daa3233 -r 81926f5cf56c lang/picoc/distinfo
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/distinfo       Fri Apr 27 04:48:44 2012 +0000
@@ -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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/patches/patch-aa
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/patches/patch-aa       Fri Apr 27 04:48:44 2012 +0000
@@ -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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/patches/patch-ab       Fri Apr 27 04:48:44 2012 +0000
@@ -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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/patches/patch-ac
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/patches/patch-ac       Fri Apr 27 04:48:44 2012 +0000
@@ -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 -r d1a07daa3233 -r 81926f5cf56c lang/picoc/patches/patch-ad
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/picoc/patches/patch-ad       Fri Apr 27 04:48:44 2012 +0000
@@ -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>



Home | Main Index | Thread Index | Old Index