From owner-svn-src-vendor@FreeBSD.ORG Sun May 10 20:01:59 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 253F5CE1; Sun, 10 May 2015 20:01:59 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F9B11453; Sun, 10 May 2015 20:01:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4AK1wm7030033; Sun, 10 May 2015 20:01:58 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4AK1tso030017; Sun, 10 May 2015 20:01:55 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201505102001.t4AK1tso030017@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sun, 10 May 2015 20:01:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282732 - in vendor/NetBSD/bmake/dist: . mk unit-tests X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2015 20:01:59 -0000 Author: sjg Date: Sun May 10 20:01:54 2015 New Revision: 282732 URL: https://svnweb.freebsd.org/changeset/base/282732 Log: Import bmake-20150505 detect typo's in .if variable references. Added: vendor/NetBSD/bmake/dist/unit-tests/cond2.exp vendor/NetBSD/bmake/dist/unit-tests/cond2.mk (contents, props changed) Modified: vendor/NetBSD/bmake/dist/ChangeLog vendor/NetBSD/bmake/dist/FILES vendor/NetBSD/bmake/dist/Makefile vendor/NetBSD/bmake/dist/cond.c vendor/NetBSD/bmake/dist/machine.sh vendor/NetBSD/bmake/dist/mk/ChangeLog vendor/NetBSD/bmake/dist/mk/dirdeps.mk vendor/NetBSD/bmake/dist/mk/install-mk vendor/NetBSD/bmake/dist/nonints.h vendor/NetBSD/bmake/dist/unit-tests/Makefile.in vendor/NetBSD/bmake/dist/var.c Modified: vendor/NetBSD/bmake/dist/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/ChangeLog Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/ChangeLog Sun May 10 20:01:54 2015 (r282732) @@ -1,3 +1,16 @@ +2015-05-05 Simon J. Gerraty + + * Makefile (MAKE_VERSION): 20150505 + Merge with NetBSD make, pick up + o cond.c: be strict about lhs of comparison when evaluating .if + but less so when called from variable expansion. + o unit-tests/cond2.mk: test various error conditions + +2015-05-04 Simon J. Gerraty + + * machine.sh (MACHINE): Add Bitrig + patch from joerg@netbsd.org + 2015-04-18 Simon J. Gerraty * Makefile (MAKE_VERSION): 20150418 Modified: vendor/NetBSD/bmake/dist/FILES ============================================================================== --- vendor/NetBSD/bmake/dist/FILES Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/FILES Sun May 10 20:01:54 2015 (r282732) @@ -96,6 +96,8 @@ unit-tests/comment.exp unit-tests/comment.mk unit-tests/cond1.exp unit-tests/cond1.mk +unit-tests/cond2.exp +unit-tests/cond2.mk unit-tests/doterror.exp unit-tests/doterror.mk unit-tests/dotwait.exp Modified: vendor/NetBSD/bmake/dist/Makefile ============================================================================== --- vendor/NetBSD/bmake/dist/Makefile Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/Makefile Sun May 10 20:01:54 2015 (r282732) @@ -1,7 +1,7 @@ -# $Id: Makefile,v 1.36 2015/04/18 19:58:53 sjg Exp $ +# $Id: Makefile,v 1.38 2015/05/05 21:58:05 sjg Exp $ # Base version on src date -MAKE_VERSION= 20150418 +MAKE_VERSION= 20150505 PROG= bmake @@ -94,7 +94,7 @@ SUBDIR+= unit-tests # we skip a lot of this when building as part of FreeBSD etc. # list of OS's which are derrived from BSD4.4 -BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly +BSD44_LIST= NetBSD FreeBSD OpenBSD DragonFly MirBSD Bitrig # we are... OS!= uname -s # are we 4.4BSD ? Modified: vendor/NetBSD/bmake/dist/cond.c ============================================================================== --- vendor/NetBSD/bmake/dist/cond.c Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/cond.c Sun May 10 20:01:54 2015 (r282732) @@ -1,4 +1,4 @@ -/* $NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $ */ +/* $NetBSD: cond.c,v 1.68 2015/05/05 21:51:09 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $"; +static char rcsid[] = "$NetBSD: cond.c,v 1.68 2015/05/05 21:51:09 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94"; #else -__RCSID("$NetBSD: cond.c,v 1.67 2012/11/03 13:59:27 christos Exp $"); +__RCSID("$NetBSD: cond.c,v 1.68 2015/05/05 21:51:09 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -181,6 +181,15 @@ static Token condPushBack=TOK_NONE; /* static unsigned int cond_depth = 0; /* current .if nesting level */ static unsigned int cond_min_depth = 0; /* depth at makefile open */ +/* + * Indicate when we should be strict about lhs of comparisons. + * TRUE when Cond_EvalExpression is called from Cond_Eval (.if etc) + * FALSE when Cond_EvalExpression is called from var.c:ApplyModifiers + * since lhs is already expanded and we cannot tell if + * it was a variable reference or not. + */ +static Boolean lhsStrict; + static int istoken(const char *str, const char *tok, size_t len) { @@ -517,7 +526,7 @@ CondCvtArg(char *str, double *value) */ /* coverity:[+alloc : arg-*2] */ static char * -CondGetString(Boolean doEval, Boolean *quoted, void **freeIt) +CondGetString(Boolean doEval, Boolean *quoted, void **freeIt, Boolean strictLHS) { Buffer buf; char *cp; @@ -601,6 +610,16 @@ CondGetString(Boolean doEval, Boolean *q condExpr--; /* don't skip over next char */ break; default: + if (strictLHS && !qt && *start != '$' && + !isdigit((unsigned char) *start)) { + /* lhs must be quoted, a variable reference or number */ + if (*freeIt) { + free(*freeIt); + *freeIt = NULL; + } + str = NULL; + goto cleanup; + } Buf_AddByte(&buf, *condExpr); break; } @@ -648,7 +667,7 @@ compare_expression(Boolean doEval) * Parse the variable spec and skip over it, saving its * value in lhs. */ - lhs = CondGetString(doEval, &lhsQuoted, &lhsFree); + lhs = CondGetString(doEval, &lhsQuoted, &lhsFree, lhsStrict); if (!lhs) goto done; @@ -709,7 +728,7 @@ compare_expression(Boolean doEval) goto done; } - rhs = CondGetString(doEval, &rhsQuoted, &rhsFree); + rhs = CondGetString(doEval, &rhsQuoted, &rhsFree, FALSE); if (!rhs) goto done; @@ -1135,7 +1154,7 @@ CondE(Boolean doEval) *----------------------------------------------------------------------- */ int -Cond_EvalExpression(const struct If *info, char *line, Boolean *value, int eprint) +Cond_EvalExpression(const struct If *info, char *line, Boolean *value, int eprint, Boolean strictLHS) { static const struct If *dflt_info; const struct If *sv_if_info = if_info; @@ -1143,6 +1162,8 @@ Cond_EvalExpression(const struct If *inf Token sv_condPushBack = condPushBack; int rval; + lhsStrict = strictLHS; + while (*line == ' ' || *line == '\t') line++; @@ -1359,7 +1380,7 @@ Cond_Eval(char *line) } /* And evaluate the conditional expresssion */ - if (Cond_EvalExpression(ifp, line, &value, 1) == COND_INVALID) { + if (Cond_EvalExpression(ifp, line, &value, 1, TRUE) == COND_INVALID) { /* Syntax error in conditional, error message already output. */ /* Skip everything to matching .endif */ cond_state[cond_depth] = SKIP_TO_ELSE; Modified: vendor/NetBSD/bmake/dist/machine.sh ============================================================================== --- vendor/NetBSD/bmake/dist/machine.sh Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/machine.sh Sun May 10 20:01:54 2015 (r282732) @@ -2,7 +2,7 @@ # derrived from /etc/rc_d/os.sh # RCSid: -# $Id: machine.sh,v 1.16 2010/10/17 00:05:51 sjg Exp $ +# $Id: machine.sh,v 1.17 2015/05/05 00:10:54 sjg Exp $ # # @(#) Copyright (c) 1994-2002 Simon J. Gerraty # @@ -49,6 +49,10 @@ OpenBSD) arch=`Which arch /usr/bin:/usr/ucb:$PATH` MACHINE_ARCH=`$arch -s`; ;; +Bitrig) + MACHINE=$OS$OSMAJOR.$machine + MACHINE_ARCH=`uname -m`; + ;; *BSD) MACHINE=$OS$OSMAJOR.$machine ;; Modified: vendor/NetBSD/bmake/dist/mk/ChangeLog ============================================================================== --- vendor/NetBSD/bmake/dist/mk/ChangeLog Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/mk/ChangeLog Sun May 10 20:01:54 2015 (r282732) @@ -1,3 +1,9 @@ +2015-04-30 Simon J. Gerraty + + * install-mk (MK_VERSION): 20150430 + + * dirdeps.mk: fix _count_dirdeps for non-cache case. + 2015-04-16 Simon J. Gerraty * install-mk (MK_VERSION): 20150411 Modified: vendor/NetBSD/bmake/dist/mk/dirdeps.mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/dirdeps.mk Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/mk/dirdeps.mk Sun May 10 20:01:54 2015 (r282732) @@ -1,4 +1,4 @@ -# $Id: dirdeps.mk,v 1.49 2015/03/11 21:39:28 sjg Exp $ +# $Id: dirdeps.mk,v 1.51 2015/05/06 06:07:30 sjg Exp $ # Copyright (c) 2010-2013, Juniper Networks, Inc. # All rights reserved. @@ -349,7 +349,7 @@ BUILD_DIRDEPS ?= yes .if !defined(NO_DIRDEPS) .if ${MK_DIRDEPS_CACHE} == "yes" # this is where we will cache all our work -DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,^,.,:N.} +DIRDEPS_CACHE?= ${_OBJDIR}/dirdeps.cache${.TARGETS:Nall:O:u:ts-:S,/,_,g:S,^,.,:N.} # just ensure this exists build-dirdeps: @@ -394,13 +394,14 @@ _count_dirdeps: .NOMETA @echo '.info $${.newline}$${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]}' >&3 .endif -.endif -.elif !target(_count_dirdeps) +.elif !make(dirdeps) && !target(_count_dirdeps) beforedirdeps: _count_dirdeps _count_dirdeps: .NOMETA @echo "${TRACER}Makefiles read: total=${.MAKE.MAKEFILES:[#]} depend=${.MAKE.MAKEFILES:M*depend*:[#]} dirdeps=${.ALLTARGETS:M${SRCTOP}*:O:u:[#]} seconds=`expr ${now_utc} - ${start_utc}`" .endif +.endif + .if ${BUILD_DIRDEPS} == "yes" .if ${DEBUG_DIRDEPS:@x@${DEP_RELDIR:M$x}${${DEP_RELDIR}.${DEP_MACHINE}:L:M$x}@} != "" _debug_reldir = 1 Modified: vendor/NetBSD/bmake/dist/mk/install-mk ============================================================================== --- vendor/NetBSD/bmake/dist/mk/install-mk Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/mk/install-mk Sun May 10 20:01:54 2015 (r282732) @@ -55,7 +55,7 @@ # Simon J. Gerraty # RCSid: -# $Id: install-mk,v 1.109 2015/04/16 16:59:00 sjg Exp $ +# $Id: install-mk,v 1.110 2015/05/01 06:37:49 sjg Exp $ # # @(#) Copyright (c) 1994 Simon J. Gerraty # @@ -70,7 +70,7 @@ # sjg@crufty.net # -MK_VERSION=20150411 +MK_VERSION=20150430 OWNER= GROUP= MODE=444 Modified: vendor/NetBSD/bmake/dist/nonints.h ============================================================================== --- vendor/NetBSD/bmake/dist/nonints.h Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/nonints.h Sun May 10 20:01:54 2015 (r282732) @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.67 2014/09/07 20:55:34 joerg Exp $ */ +/* $NetBSD: nonints.h,v 1.68 2015/05/05 21:51:09 sjg Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -91,7 +91,7 @@ int Compat_Make(void *, void *); /* cond.c */ struct If; -int Cond_EvalExpression(const struct If *, char *, Boolean *, int); +int Cond_EvalExpression(const struct If *, char *, Boolean *, int, Boolean); int Cond_Eval(char *); void Cond_restore_depth(unsigned int); unsigned int Cond_save_depth(void); Modified: vendor/NetBSD/bmake/dist/unit-tests/Makefile.in ============================================================================== --- vendor/NetBSD/bmake/dist/unit-tests/Makefile.in Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/unit-tests/Makefile.in Sun May 10 20:01:54 2015 (r282732) @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.46 2014/11/06 01:47:57 sjg Exp $ +# $Id: Makefile.in,v 1.47 2015/05/05 21:58:06 sjg Exp $ # -# $NetBSD: Makefile,v 1.51 2014/10/20 23:21:11 sjg Exp $ +# $NetBSD: Makefile,v 1.52 2015/05/05 21:51:09 sjg Exp $ # # Unit tests for make(1) # The main targets are: @@ -27,6 +27,7 @@ UNIT_TESTS:= ${srcdir} TESTNAMES= \ comment \ cond1 \ + cond2 \ error \ export \ export-all \ Added: vendor/NetBSD/bmake/dist/unit-tests/cond2.exp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/bmake/dist/unit-tests/cond2.exp Sun May 10 20:01:54 2015 (r282732) @@ -0,0 +1,7 @@ +make: Bad conditional expression ` == "empty"' in == "empty"?oops:ok +make: "cond2.mk" line 13: Malformed conditional ({TEST_TYPO} == "Ok") +TEST_NOT_SET is empty or not defined +make: "cond2.mk" line 20: Malformed conditional (${TEST_NOT_SET} == "empty") +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Added: vendor/NetBSD/bmake/dist/unit-tests/cond2.mk ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/NetBSD/bmake/dist/unit-tests/cond2.mk Sun May 10 20:01:54 2015 (r282732) @@ -0,0 +1,25 @@ +# $Id: cond2.mk,v 1.1.1.1 2015/05/05 21:53:13 sjg Exp $ + +TEST_UNAME_S= NetBSD + +# this should be ok +X:= ${${TEST_UNAME_S} == "NetBSD":?Ok:fail} +.if $X == "Ok" +Y= good +.endif +# expect: Bad conditional expression ` == "empty"' in == "empty"?oops:ok +X:= ${${TEST_NOT_SET} == "empty":?oops:ok} +# expect: Malformed conditional ({TEST_TYPO} == "Ok") +.if {TEST_TYPO} == "Ok" +Y= oops +.endif +.if empty(TEST_NOT_SET) +Y!= echo TEST_NOT_SET is empty or not defined >&2; echo +.endif +# expect: Malformed conditional (${TEST_NOT_SET} == "empty") +.if ${TEST_NOT_SET} == "empty" +Y= oops +.endif + +all: + @echo $@ Modified: vendor/NetBSD/bmake/dist/var.c ============================================================================== --- vendor/NetBSD/bmake/dist/var.c Sun May 10 19:14:28 2015 (r282731) +++ vendor/NetBSD/bmake/dist/var.c Sun May 10 20:01:54 2015 (r282732) @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.191 2014/09/14 02:32:51 dholland Exp $ */ +/* $NetBSD: var.c,v 1.192 2015/05/05 21:51:09 sjg Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.191 2014/09/14 02:32:51 dholland Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.192 2015/05/05 21:51:09 sjg Exp $"; #else #include #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.191 2014/09/14 02:32:51 dholland Exp $"); +__RCSID("$NetBSD: var.c,v 1.192 2015/05/05 21:51:09 sjg Exp $"); #endif #endif /* not lint */ #endif @@ -3260,7 +3260,7 @@ ApplyModifiers(char *nstr, const char *t termc = *--cp; delim = '\0'; - if (Cond_EvalExpression(NULL, v->name, &value, 0) + if (Cond_EvalExpression(NULL, v->name, &value, 0, FALSE) == COND_INVALID) { Error("Bad conditional expression `%s' in %s?%s:%s", v->name, v->name, pattern.lhs, pattern.rhs); From owner-svn-src-vendor@FreeBSD.ORG Sun May 10 20:02:27 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B6010E0F; Sun, 10 May 2015 20:02:27 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A3981459; Sun, 10 May 2015 20:02:27 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4AK2Rli030152; Sun, 10 May 2015 20:02:27 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4AK2R94030151; Sun, 10 May 2015 20:02:27 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201505102002.t4AK2R94030151@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Sun, 10 May 2015 20:02:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282733 - vendor/NetBSD/bmake/20150505 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2015 20:02:27 -0000 Author: sjg Date: Sun May 10 20:02:26 2015 New Revision: 282733 URL: https://svnweb.freebsd.org/changeset/base/282733 Log: Tag bmake-20150505 Added: vendor/NetBSD/bmake/20150505/ - copied from r282732, vendor/NetBSD/bmake/dist/ From owner-svn-src-vendor@FreeBSD.ORG Mon May 11 14:02:41 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 17E78A80; Mon, 11 May 2015 14:02:41 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0293916E4; Mon, 11 May 2015 14:02:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4BE2eO8073832; Mon, 11 May 2015 14:02:40 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4BE2cna073813; Mon, 11 May 2015 14:02:38 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505111402.t4BE2cna073813@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 11 May 2015 14:02:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282768 - in vendor/ficl: . dist dist/contrib dist/contrib/xclasses dist/doc dist/doc/articles dist/doc/graphics dist/doc/source dist/ficlplatform dist/softcore dist/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2015 14:02:41 -0000 Author: pfg Date: Mon May 11 14:02:38 2015 New Revision: 282768 URL: https://svnweb.freebsd.org/changeset/base/282768 Log: Bring ficl4 to the vendor area. We currently use ficl3 but there is interest (and a GSoC) to bring the newer version for use in the bootloader. WWW: http://ficl.sourceforge.net/ Discussed with: dteske Added: vendor/ficl/ vendor/ficl/dist/ vendor/ficl/dist/Makefile (contents, props changed) vendor/ficl/dist/Makefile.ansi (contents, props changed) vendor/ficl/dist/Makefile.linux (contents, props changed) vendor/ficl/dist/ReadMe.txt (contents, props changed) vendor/ficl/dist/bit.c (contents, props changed) vendor/ficl/dist/callback.c (contents, props changed) vendor/ficl/dist/compatibility.c (contents, props changed) vendor/ficl/dist/contrib/ vendor/ficl/dist/contrib/xclasses/ vendor/ficl/dist/contrib/xclasses/readme.txt (contents, props changed) vendor/ficl/dist/contrib/xclasses/xclasses.py (contents, props changed) vendor/ficl/dist/dictionary.c (contents, props changed) vendor/ficl/dist/doc/ vendor/ficl/dist/doc/api.html (contents, props changed) vendor/ficl/dist/doc/articles/ vendor/ficl/dist/doc/articles/ficlddj.pdf (contents, props changed) vendor/ficl/dist/doc/articles/jwsforml.pdf (contents, props changed) vendor/ficl/dist/doc/articles/oo_in_c.html (contents, props changed) vendor/ficl/dist/doc/articles/sigplan9906.doc (contents, props changed) vendor/ficl/dist/doc/debugger.html (contents, props changed) vendor/ficl/dist/doc/dpans.html (contents, props changed) vendor/ficl/dist/doc/favicon.ico (contents, props changed) vendor/ficl/dist/doc/ficl.html (contents, props changed) vendor/ficl/dist/doc/graphics/ vendor/ficl/dist/doc/graphics/4ring.gif (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.128.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.64.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.96.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_oop.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_top.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/sourceforge.jpg (contents, props changed) vendor/ficl/dist/doc/index.html (contents, props changed) vendor/ficl/dist/doc/license.html (contents, props changed) vendor/ficl/dist/doc/links.html (contents, props changed) vendor/ficl/dist/doc/locals.html (contents, props changed) vendor/ficl/dist/doc/oop.html (contents, props changed) vendor/ficl/dist/doc/parsesteps.html (contents, props changed) vendor/ficl/dist/doc/releases.html (contents, props changed) vendor/ficl/dist/doc/source/ vendor/ficl/dist/doc/source/api.ht vendor/ficl/dist/doc/source/debugger.ht vendor/ficl/dist/doc/source/dpans.ht vendor/ficl/dist/doc/source/ficl.ht vendor/ficl/dist/doc/source/generate.py (contents, props changed) vendor/ficl/dist/doc/source/index.ht vendor/ficl/dist/doc/source/license.ht vendor/ficl/dist/doc/source/links.ht vendor/ficl/dist/doc/source/locals.ht vendor/ficl/dist/doc/source/oop.ht vendor/ficl/dist/doc/source/parsesteps.ht vendor/ficl/dist/doc/source/releases.ht vendor/ficl/dist/doc/source/upgrading.ht vendor/ficl/dist/doc/upgrading.html (contents, props changed) vendor/ficl/dist/double.c (contents, props changed) vendor/ficl/dist/extras.c (contents, props changed) vendor/ficl/dist/ficl.dsw vendor/ficl/dist/ficl.h (contents, props changed) vendor/ficl/dist/ficlcompatibility.h (contents, props changed) vendor/ficl/dist/ficldll.def vendor/ficl/dist/ficldll.dsp vendor/ficl/dist/ficlexe.dsp vendor/ficl/dist/ficllib.dsp vendor/ficl/dist/ficllocal.h (contents, props changed) vendor/ficl/dist/ficlplatform/ vendor/ficl/dist/ficlplatform/alpha.h (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.c (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.h (contents, props changed) vendor/ficl/dist/ficlplatform/ficlexports.txt (contents, props changed) vendor/ficl/dist/ficlplatform/makedef.py (contents, props changed) vendor/ficl/dist/ficlplatform/unix.c (contents, props changed) vendor/ficl/dist/ficlplatform/unix.h (contents, props changed) vendor/ficl/dist/ficlplatform/win32.c (contents, props changed) vendor/ficl/dist/ficlplatform/win32.h (contents, props changed) vendor/ficl/dist/ficltokens.h (contents, props changed) vendor/ficl/dist/fileaccess.c (contents, props changed) vendor/ficl/dist/float.c (contents, props changed) vendor/ficl/dist/hash.c (contents, props changed) vendor/ficl/dist/lzcompress.c (contents, props changed) vendor/ficl/dist/lzuncompress.c (contents, props changed) vendor/ficl/dist/main.c (contents, props changed) vendor/ficl/dist/prefix.c (contents, props changed) vendor/ficl/dist/primitives.c (contents, props changed) vendor/ficl/dist/search.c (contents, props changed) vendor/ficl/dist/softcore/ vendor/ficl/dist/softcore.c (contents, props changed) vendor/ficl/dist/softcore/classes.fr vendor/ficl/dist/softcore/ficl.fr vendor/ficl/dist/softcore/ficlclass.fr vendor/ficl/dist/softcore/ficllocal.fr vendor/ficl/dist/softcore/fileaccess.fr vendor/ficl/dist/softcore/forml.fr vendor/ficl/dist/softcore/ifbrack.fr vendor/ficl/dist/softcore/jhlocal.fr vendor/ficl/dist/softcore/make.bat vendor/ficl/dist/softcore/makefile (contents, props changed) vendor/ficl/dist/softcore/makesoftcore.c (contents, props changed) vendor/ficl/dist/softcore/marker.fr vendor/ficl/dist/softcore/oo.fr vendor/ficl/dist/softcore/prefix.fr vendor/ficl/dist/softcore/softcore.fr vendor/ficl/dist/softcore/string.fr vendor/ficl/dist/softcore/win32.fr vendor/ficl/dist/stack.c (contents, props changed) vendor/ficl/dist/system.c (contents, props changed) vendor/ficl/dist/test/ vendor/ficl/dist/test/asm68k.4th vendor/ficl/dist/test/core.fr vendor/ficl/dist/test/fib.fr vendor/ficl/dist/test/ficltest.fr vendor/ficl/dist/test/ooptest.fr vendor/ficl/dist/test/prefix.fr vendor/ficl/dist/test/sarray.fr vendor/ficl/dist/test/testcase.fr vendor/ficl/dist/test/tester.fr vendor/ficl/dist/test/vocab.fr vendor/ficl/dist/tools.c (contents, props changed) vendor/ficl/dist/utility.c (contents, props changed) vendor/ficl/dist/vm.c (contents, props changed) vendor/ficl/dist/word.c (contents, props changed) Added: vendor/ficl/dist/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,60 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +#TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) -Wall +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +# depend explicitly to help finding source files in another subdirectory, +# and repeat commands since gmake doesn't understand otherwise +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* ficl Added: vendor/ficl/dist/Makefile.ansi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile.ansi Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o ansi.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/ansi.h +# +# Flags for shared library +TARGET= -ansi -DFICL_ANSI # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/ansi.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Added: vendor/ficl/dist/Makefile.linux ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile.linux Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/unix.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Added: vendor/ficl/dist/ReadMe.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/ReadMe.txt Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,53 @@ +FICL 4.1.0 +October 2010 + +________ +OVERVIEW + +Ficl is a complete programming language interpreter designed to be embedded +into other systems (including firmware based ones) as a command, macro, +and development prototype language. Ficl stands for "Forth Inspired +Command Language". + +For more information, please see the "doc" directory. +For release notes, please see "doc/releases.html". + +____________ +INSTALLATION + +Ficl builds out-of-the-box on the following platforms: + * NetBSD, FreeBSD: use "Makefile". + * Linux: use "Makefile.linux", but it should work with + "Makefile" as well. + * Win32: use "ficl.dsw" / "ficl.dsp". +To port to other platforms, we suggest you start with the generic +"Makefile" and the "unix.c" / "unix.h" platform-specific implementation +files. (And please--feel free to submit your portability changes!) + +(Note: Ficl used to build under RiscOS, but we broke everything +for the 4.0 release. Please fix it and send us the diffs!) + +____________ +FICL LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + Added: vendor/ficl/dist/bit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/bit.c Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,49 @@ +#include "ficl.h" + +int ficlBitGet(const unsigned char *bits, size_t index) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + return ((mask & bits[byteIndex]) ? 1 : 0); + } + + + +void ficlBitSet(unsigned char *bits, size_t index, int value) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + if (value) + bits[byteIndex] |= mask; + else + bits[byteIndex] &= ~mask; + } + + +void ficlBitGetString(unsigned char *destination, const unsigned char *source, int offset, int count, int destAlignment) + { + int bit = destAlignment - count; + while (count--) + ficlBitSet(destination, bit++, ficlBitGet(source, offset++)); + } + + +/* +** This will actually work correctly *regardless* of the local architecture. +** --lch +**/ +ficlUnsigned16 ficlNetworkUnsigned16(ficlUnsigned16 number) +{ + ficlUnsigned8 *pointer = (ficlUnsigned8 *)&number; + return (ficlUnsigned16)(((ficlUnsigned16)(pointer[0] << 8)) | (pointer[1])); +} + +ficlUnsigned32 ficlNetworkUnsigned32(ficlUnsigned32 number) +{ + ficlUnsigned16 *pointer = (ficlUnsigned16 *)&number; + return ((ficlUnsigned32)(ficlNetworkUnsigned16(pointer[0]) << 16)) | ficlNetworkUnsigned16(pointer[1]); +} Added: vendor/ficl/dist/callback.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/callback.c Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,76 @@ +#include "ficl.h" + + +extern ficlSystem *ficlSystemGlobal; + +/************************************************************************** + f i c l C a l l b a c k T e x t O u t +** Feeds text to the vm's output callback +**************************************************************************/ +void ficlCallbackTextOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction textOut = NULL; + + if (callback != NULL) + { + if (callback->textOut != NULL) + textOut = callback->textOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackTextOut(&(callback->system->callback), text); + return; + } + } + + if ((textOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + textOut = callback->textOut; + } + + if (textOut == NULL) + textOut = ficlCallbackDefaultTextOut; + + (textOut)(callback, text); + + return; +} + + +/************************************************************************** + f i c l C a l l b a c k E r r o r O u t +** Feeds text to the vm's error output callback +**************************************************************************/ +void ficlCallbackErrorOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction errorOut = NULL; + + if (callback != NULL) + { + if (callback->errorOut != NULL) + errorOut = callback->errorOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackErrorOut(&(callback->system->callback), text); + return; + } + } + + if ((errorOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + errorOut = callback->errorOut; + } + + if (errorOut == NULL) + { + ficlCallbackTextOut(callback, text); + return; + } + + (errorOut)(callback, text); + + return; +} + + Added: vendor/ficl/dist/compatibility.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/compatibility.c Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,284 @@ +#define FICL_FORCE_COMPATIBILITY 1 +#include "ficl.h" + + +FICL_PLATFORM_EXTERN ficlStack *stackCreate (unsigned cells) { return ficlStackCreate(NULL, "unknown", cells); } +FICL_PLATFORM_EXTERN void stackDelete (ficlStack *stack) { ficlStackDestroy(stack); } +FICL_PLATFORM_EXTERN int stackDepth (ficlStack *stack) { return ficlStackDepth(stack); } +FICL_PLATFORM_EXTERN void stackDrop (ficlStack *stack, int n) { ficlStackDrop(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackFetch (ficlStack *stack, int n) { return ficlStackFetch(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackGetTop (ficlStack *stack) { return ficlStackFetch(stack, 0); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN void stackLink (ficlStack *stack, int cells) { ficlStackLink(stack, cells); } +FICL_PLATFORM_EXTERN void stackUnlink (ficlStack *stack) { ficlStackUnlink(stack); } +#endif /* FICL_WANT_LOCALS */ +FICL_PLATFORM_EXTERN void stackPick (ficlStack *stack, int n) { ficlStackPick(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackPop (ficlStack *stack) { return ficlStackPop(stack); } +FICL_PLATFORM_EXTERN void *stackPopPtr (ficlStack *stack) { return ficlStackPopPointer(stack); } +FICL_PLATFORM_EXTERN ficlUnsigned stackPopUNS (ficlStack *stack) { return ficlStackPopUnsigned(stack); } +FICL_PLATFORM_EXTERN ficlInteger stackPopINT (ficlStack *stack) { return ficlStackPopInteger(stack); } +FICL_PLATFORM_EXTERN void stackPush (ficlStack *stack, ficlCell cell) { ficlStackPush(stack, cell); } +FICL_PLATFORM_EXTERN void stackPushPtr (ficlStack *stack, void *pointer) { ficlStackPushPointer(stack, pointer); } +FICL_PLATFORM_EXTERN void stackPushUNS (ficlStack *stack, ficlUnsigned u) { ficlStackPushUnsigned(stack, u); } +FICL_PLATFORM_EXTERN void stackPushINT (ficlStack *stack, ficlInteger i) { ficlStackPushInteger(stack, i); } +FICL_PLATFORM_EXTERN void stackReset (ficlStack *stack) { ficlStackReset(stack); } +FICL_PLATFORM_EXTERN void stackRoll (ficlStack *stack, int n) { ficlStackRoll(stack, n); } +FICL_PLATFORM_EXTERN void stackSetTop (ficlStack *stack, ficlCell cell) { ficlStackSetTop(stack, cell); } +FICL_PLATFORM_EXTERN void stackStore (ficlStack *stack, int n, ficlCell cell) { ficlStackStore(stack, n, cell); } + +#if (FICL_WANT_FLOAT) +FICL_PLATFORM_EXTERN ficlFloat stackPopFloat (ficlStack *stack) { return ficlStackPopFloat(stack); } +FICL_PLATFORM_EXTERN void stackPushFloat(ficlStack *stack, ficlFloat f) { ficlStackPushFloat(stack, f); } +#endif + +FICL_PLATFORM_EXTERN int wordIsImmediate(ficlWord *word) { return ficlWordIsImmediate(word); } +FICL_PLATFORM_EXTERN int wordIsCompileOnly(ficlWord *word) { return ficlWordIsCompileOnly(word); } + + +FICL_PLATFORM_EXTERN void vmBranchRelative(ficlVm *vm, int offset) { ficlVmBranchRelative(vm, offset); } +FICL_PLATFORM_EXTERN ficlVm *vmCreate (ficlVm *vm, unsigned nPStack, unsigned nRStack) { return ficlVmCreate(vm, nPStack, nRStack); } +FICL_PLATFORM_EXTERN void vmDelete (ficlVm *vm) { ficlVmDestroy(vm); } +FICL_PLATFORM_EXTERN void vmExecute (ficlVm *vm, ficlWord *word) { ficlVmExecuteWord(vm, word); } +FICL_PLATFORM_EXTERN ficlDictionary *vmGetDict (ficlVm *vm) { return ficlVmGetDictionary(vm); } +FICL_PLATFORM_EXTERN char * vmGetString (ficlVm *vm, ficlCountedString *spDest, char delimiter) { return ficlVmGetString(vm, spDest, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmGetWord (ficlVm *vm) { return ficlVmGetWord(vm); } +FICL_PLATFORM_EXTERN ficlString vmGetWord0 (ficlVm *vm) { return ficlVmGetWord0(vm); } +FICL_PLATFORM_EXTERN int vmGetWordToPad (ficlVm *vm) { return ficlVmGetWordToPad(vm); } +FICL_PLATFORM_EXTERN ficlString vmParseString (ficlVm *vm, char delimiter) { return ficlVmParseString(vm, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmParseStringEx(ficlVm *vm, char delimiter, char skipLeading) { return ficlVmParseStringEx(vm, delimiter, skipLeading); } +FICL_PLATFORM_EXTERN ficlCell vmPop (ficlVm *vm) { return ficlVmPop(vm); } +FICL_PLATFORM_EXTERN void vmPush (ficlVm *vm, ficlCell cell) { ficlVmPush(vm, cell); } +FICL_PLATFORM_EXTERN void vmPopIP (ficlVm *vm) { ficlVmPopIP(vm); } +FICL_PLATFORM_EXTERN void vmPushIP (ficlVm *vm, ficlIp newIP) { ficlVmPushIP(vm, newIP); } +FICL_PLATFORM_EXTERN void vmQuit (ficlVm *vm) { ficlVmQuit(vm); } +FICL_PLATFORM_EXTERN void vmReset (ficlVm *vm) { ficlVmReset(vm); } +FICL_PLATFORM_EXTERN void vmThrow (ficlVm *vm, int except) { ficlVmThrow(vm, except); } +FICL_PLATFORM_EXTERN void vmThrowErr (ficlVm *vm, char *fmt, ...) { va_list list; va_start(list, fmt); ficlVmThrowErrorVararg(vm, fmt, list); va_end(list); } + +FICL_PLATFORM_EXTERN void vmCheckStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->dataStack, popCells, pushCells); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void vmCheckFStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->floatStack, popCells, pushCells); } +#endif + +FICL_PLATFORM_EXTERN void vmPushTib (ficlVm *vm, char *text, ficlInteger nChars, ficlTIB *pSaveTib) { ficlVmPushTib(vm, text, nChars, pSaveTib); } +FICL_PLATFORM_EXTERN void vmPopTib (ficlVm *vm, ficlTIB *pTib) { ficlVmPopTib(vm, pTib); } + +FICL_PLATFORM_EXTERN int isPowerOfTwo(ficlUnsigned u) { return ficlIsPowerOfTwo(u); } + +#if defined(_WIN32) +/* #SHEESH +** Why do Microsoft Meatballs insist on contaminating +** my namespace with their string functions??? +*/ +#pragma warning(disable: 4273) +#endif +char *ltoa(ficlInteger value, char *string, int radix ) { return ficlLtoa(value, string, radix); } +char *ultoa(ficlUnsigned value, char *string, int radix ) { return ficlUltoa(value, string, radix); } +char *strrev( char *string ) { return ficlStringReverse(string); } +#if defined(_WIN32) +#pragma warning(default: 4273) +#endif +FICL_PLATFORM_EXTERN char digit_to_char(int value) { return ficlDigitToCharacter(value); } +FICL_PLATFORM_EXTERN char *skipSpace(char *cp, char *end) { return ficlStringSkipSpace(cp, end); } +FICL_PLATFORM_EXTERN char *caseFold(char *cp) { return ficlStringCaseFold(cp); } +FICL_PLATFORM_EXTERN int strincmp(char *cp1, char *cp2, ficlUnsigned count) { return ficlStrincmp(cp1, cp2, count); } + +FICL_PLATFORM_EXTERN void hashForget (ficlHash *hash, void *where) { ficlHashForget(hash, where); } +FICL_PLATFORM_EXTERN ficlUnsigned16 hashHashCode (ficlString string) { return ficlHashCode(string); } +FICL_PLATFORM_EXTERN void hashInsertWord(ficlHash *hash, ficlWord *word) { ficlHashInsertWord(hash, word); } +FICL_PLATFORM_EXTERN ficlWord *hashLookup (ficlHash *hash, ficlString string, ficlUnsigned16 hashCode) { return ficlHashLookup(hash, string, hashCode); } +FICL_PLATFORM_EXTERN void hashReset (ficlHash *hash) { ficlHashReset(hash); } + + +FICL_PLATFORM_EXTERN void *alignPtr(void *ptr) { return ficlAlignPointer(ptr); } +FICL_PLATFORM_EXTERN void dictAbortDefinition(ficlDictionary *dictionary) { ficlDictionaryAbortDefinition(dictionary); } +FICL_PLATFORM_EXTERN void dictAlign (ficlDictionary *dictionary) { ficlDictionaryAlign(dictionary); } +FICL_PLATFORM_EXTERN int dictAllot (ficlDictionary *dictionary, int n) { ficlDictionaryAllot(dictionary, n); return 0; } +FICL_PLATFORM_EXTERN int dictAllotCells (ficlDictionary *dictionary, int cells) { ficlDictionaryAllotCells(dictionary, cells); return 0; } +FICL_PLATFORM_EXTERN void dictAppendCell (ficlDictionary *dictionary, ficlCell cell) { ficlDictionaryAppendCell(dictionary, cell); } +FICL_PLATFORM_EXTERN void dictAppendChar (ficlDictionary *dictionary, char c) { ficlDictionaryAppendCharacter(dictionary, c); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord (ficlDictionary *dictionary, + char *name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendPrimitive(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord2(ficlDictionary *dictionary, + ficlString name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendWord(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN void dictAppendUNS (ficlDictionary *dictionary, ficlUnsigned u) { ficlDictionaryAppendUnsigned(dictionary, u); } +FICL_PLATFORM_EXTERN int dictCellsAvail (ficlDictionary *dictionary) { return ficlDictionaryCellsAvailable(dictionary); } +FICL_PLATFORM_EXTERN int dictCellsUsed (ficlDictionary *dictionary) { return ficlDictionaryCellsUsed(dictionary); } +FICL_PLATFORM_EXTERN void dictCheck (ficlDictionary *dictionary, ficlVm *vm, int n) { FICL_IGNORE(dictionary); FICL_IGNORE(vm); FICL_IGNORE(n); FICL_VM_DICTIONARY_CHECK(vm, dictionary, n); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreate(unsigned cells) { return ficlDictionaryCreate(NULL, cells); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreateHashed(unsigned cells, unsigned hash) { return ficlDictionaryCreateHashed(NULL, cells, hash); } +FICL_PLATFORM_EXTERN ficlHash *dictCreateWordlist(ficlDictionary *dictionary, int nBuckets) { return ficlDictionaryCreateWordlist(dictionary, nBuckets); } +FICL_PLATFORM_EXTERN void dictDelete (ficlDictionary *dictionary) { ficlDictionaryDestroy(dictionary); } +FICL_PLATFORM_EXTERN void dictEmpty (ficlDictionary *dictionary, unsigned nHash) { ficlDictionaryEmpty(dictionary, nHash); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlPrimitiveHashSummary(ficlVm *vm); +FICL_PLATFORM_EXTERN void dictHashSummary(ficlVm *vm) { ficlPrimitiveHashSummary(vm); } +#endif +FICL_PLATFORM_EXTERN int dictIncludes (ficlDictionary *dictionary, void *p) { return ficlDictionaryIncludes(dictionary, p); } +FICL_PLATFORM_EXTERN ficlWord *dictLookup (ficlDictionary *dictionary, ficlString name) { return ficlDictionaryLookup(dictionary, name); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlWord *ficlLookupLoc (ficlSystem *system, ficlString name) { return ficlDictionaryLookup(ficlSystemGetLocals(system), name); } +#endif +FICL_PLATFORM_EXTERN void dictResetSearchOrder(ficlDictionary *dictionary) { ficlDictionaryResetSearchOrder(dictionary); } +FICL_PLATFORM_EXTERN void dictSetFlags (ficlDictionary *dictionary, ficlUnsigned8 set, ficlUnsigned8 clear) { ficlDictionarySetFlags(dictionary, set); ficlDictionaryClearFlags(dictionary, clear); } +FICL_PLATFORM_EXTERN void dictSetImmediate(ficlDictionary *dictionary) { ficlDictionarySetImmediate(dictionary); } +FICL_PLATFORM_EXTERN void dictUnsmudge (ficlDictionary *dictionary) { ficlDictionaryUnsmudge(dictionary); } +FICL_PLATFORM_EXTERN ficlCell *dictWhere (ficlDictionary *dictionary) { return ficlDictionaryWhere(dictionary); } + +FICL_PLATFORM_EXTERN int ficlAddParseStep(ficlSystem *system, ficlWord *word) { return ficlSystemAddParseStep(system, word); } +FICL_PLATFORM_EXTERN void ficlAddPrecompiledParseStep(ficlSystem *system, char *name, ficlParseStep pStep) { ficlSystemAddPrimitiveParseStep(system, name, pStep); } +FICL_PLATFORM_EXTERN void ficlPrimitiveParseStepList(ficlVm *vm); +FICL_PLATFORM_EXTERN void ficlListParseSteps(ficlVm *vm) { ficlPrimitiveParseStepList(vm); } + +FICL_PLATFORM_EXTERN void ficlTermSystem(ficlSystem *system) { ficlSystemDestroy(system); } +FICL_PLATFORM_EXTERN int ficlEvaluate(ficlVm *vm, char *pText) { return ficlVmEvaluate(vm, pText); } +FICL_PLATFORM_EXTERN int ficlExec (ficlVm *vm, char *pText) { ficlString s; FICL_STRING_SET_FROM_CSTRING(s, pText); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecC(ficlVm *vm, char *pText, ficlInteger nChars) { ficlString s; FICL_STRING_SET_POINTER(s, pText); FICL_STRING_SET_LENGTH(s, nChars); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecXT(ficlVm *vm, ficlWord *word) { return ficlVmExecuteXT(vm, word); } +FICL_PLATFORM_EXTERN void ficlFreeVM(ficlVm *vm) { ficlVmDestroy(vm); } + + + + + +static void thunkTextOut(ficlCallback *callback, char *text) + { + ficlCompatibilityOutputFunction outputFunction; + if ((callback->vm != NULL) && (callback->vm->thunkedTextout != NULL)) + outputFunction = callback->system->thunkedTextout; + else if (callback->system->thunkedTextout != NULL) + outputFunction = callback->system->thunkedTextout; + else + { + ficlCallbackDefaultTextOut(callback, text); + return; + } + ficlCompatibilityTextOutCallback(callback, text, outputFunction); + } + + +FICL_PLATFORM_EXTERN void vmSetTextOut(ficlVm *vm, ficlCompatibilityOutputFunction textOut) + { + vm->thunkedTextout = textOut; + ficlVmSetTextOut(vm, thunkTextOut); + } + +FICL_PLATFORM_EXTERN void vmTextOut (ficlVm *vm, char *text, int fNewline) + { + ficlVmTextOut(vm, text); + if (fNewline) + ficlVmTextOut(vm, "\n"); + } + + +FICL_PLATFORM_EXTERN void ficlTextOut (ficlVm *vm, char *text, int fNewline) + { + vmTextOut(vm, text, fNewline); + } + +extern ficlSystem *ficlSystemGlobal; +static defaultStackSize = FICL_DEFAULT_STACK_SIZE; +FICL_PLATFORM_EXTERN int ficlSetStackSize(int nStackCells) +{ + if (defaultStackSize < nStackCells) + defaultStackSize = nStackCells; + if ((ficlSystemGlobal != NULL) && (ficlSystemGlobal->stackSize < nStackCells)) + ficlSystemGlobal->stackSize = nStackCells; + return defaultStackSize; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystemEx(ficlSystemInformation *fsi) +{ + ficlSystem *returnValue; + ficlCompatibilityOutputFunction thunkedTextout; + ficlSystemInformation clone; + + memcpy(&clone, fsi, sizeof(clone)); + thunkedTextout = (ficlCompatibilityOutputFunction)clone.textOut; + clone.textOut = clone.errorOut = thunkTextOut; + + returnValue = ficlSystemCreate(&clone); + if (returnValue != NULL) + { + returnValue->thunkedTextout = thunkedTextout; + } + return returnValue; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystem(int nDictCells) +{ + ficlSystemInformation fsi; + ficlSystemInformationInitialize(&fsi); + fsi.dictionarySize = nDictCells; + if (fsi.stackSize < defaultStackSize) + fsi.stackSize = defaultStackSize; + return ficlSystemCreate(&fsi); +} + + + + +FICL_PLATFORM_EXTERN ficlVm *ficlNewVM(ficlSystem *system) +{ + ficlVm *returnValue = ficlSystemCreateVm(system); + if (returnValue != NULL) + { + if ((returnValue->callback.textOut != NULL) && (returnValue->callback.textOut != thunkTextOut)) + { + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.textOut; + returnValue->callback.textOut = thunkTextOut; + } + if ((returnValue->callback.errorOut != NULL) && (returnValue->callback.errorOut != thunkTextOut)) + { + if (returnValue->thunkedTextout == NULL) + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.errorOut; + returnValue->callback.errorOut = thunkTextOut; + } + } + return returnValue; +} + + + +FICL_PLATFORM_EXTERN ficlWord *ficlLookup(ficlSystem *system, char *name) { return ficlSystemLookup(system, name); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetDict(ficlSystem *system) { return ficlSystemGetDictionary(system); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetEnv (ficlSystem *system) { return ficlSystemGetEnvironment(system); } +FICL_PLATFORM_EXTERN void ficlSetEnv (ficlSystem *system, char *name, ficlInteger value) { ficlDictionarySetConstant(ficlSystemGetDictionary(system), name, value); } +FICL_PLATFORM_EXTERN void ficlSetEnvD(ficlSystem *system, char *name, ficlInteger high, ficlInteger low) { ficl2Unsigned value; FICL_2UNSIGNED_SET(low, high, value); ficlDictionarySet2Constant(ficlSystemGetDictionary(system), name, FICL_2UNSIGNED_TO_2INTEGER(value)); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetLoc (ficlSystem *system) { return ficlSystemGetLocals(system); } +#endif +FICL_PLATFORM_EXTERN int ficlBuild(ficlSystem *system, char *name, ficlPrimitive code, char flags) { ficlDictionary *dictionary = ficlSystemGetDictionary(system); ficlDictionaryLock(dictionary, FICL_TRUE); ficlDictionaryAppendPrimitive(dictionary, name, code, flags); ficlDictionaryLock(dictionary, FICL_FALSE); return 0; } +FICL_PLATFORM_EXTERN void ficlCompileCore(ficlSystem *system) { ficlSystemCompileCore(system); } +FICL_PLATFORM_EXTERN void ficlCompilePrefix(ficlSystem *system) { ficlSystemCompilePrefix(system); } +FICL_PLATFORM_EXTERN void ficlCompileSearch(ficlSystem *system) { ficlSystemCompileSearch(system); } +FICL_PLATFORM_EXTERN void ficlCompileSoftCore(ficlSystem *system) { ficlSystemCompileSoftCore(system); } +FICL_PLATFORM_EXTERN void ficlCompileTools(ficlSystem *system) { ficlSystemCompileTools(system); } +FICL_PLATFORM_EXTERN void ficlCompileFile(ficlSystem *system) { ficlSystemCompileFile(system); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlCompileFloat(ficlSystem *system) { ficlSystemCompileFloat(system); } +FICL_PLATFORM_EXTERN int ficlParseFloatNumber( ficlVm *vm, ficlString string) { return ficlVmParseFloatNumber(vm, string); } +#endif +#if FICL_WANT_PLATFORM +FICL_PLATFORM_EXTERN void ficlCompilePlatform(ficlSystem *system) { ficlSystemCompilePlatform(system); } +#endif +FICL_PLATFORM_EXTERN int ficlParsePrefix(ficlVm *vm, ficlString string) { return ficlVmParsePrefix(vm, string); } + +FICL_PLATFORM_EXTERN int ficlParseNumber(ficlVm *vm, ficlString string) { return ficlVmParseNumber(vm, string); } +FICL_PLATFORM_EXTERN void ficlTick(ficlVm *vm) { ficlPrimitiveTick(vm); } +FICL_PLATFORM_EXTERN void parseStepParen(ficlVm *vm) { ficlPrimitiveParseStepParen(vm); } + +FICL_PLATFORM_EXTERN int isAFiclWord(ficlDictionary *dictionary, ficlWord *word) { return ficlDictionaryIsAWord(dictionary, word); } + + +FICL_PLATFORM_EXTERN void buildTestInterface(ficlSystem *system) { ficlSystemCompileExtras(system); } + + Added: vendor/ficl/dist/contrib/xclasses/readme.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/readme.txt Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,111 @@ +XClasses is a simple IDL written in Python. +You declare your classes, methods, and members as Python objects, +and XClasses will generate the .c, .h, and .f files for you. +Not only do the Forth classes line up with their C counterparts +exactly, but all non-static methods (virtual and non-virtual) +are *automatically* thunked. In other words, any method +declared in XClasses and implemented in C can be called from +the matching Ficl class, and the C method will be automatically +called with the correct arguments. XClasses handles floating-point +arguments too! + +Known limitations: + * All arguments must be one cell wide. (That means + only single-precision floats, too.) + + + +To use: + * Declare all your classes in a .py script + * Include "xclasses.h" everywhere you need your classes + * Include xclasses.cpp in your project somewhere + * Call + "xclasses.f" included + from your Ficl initialization script + +And you're mostly done! + +Simply including xclasses.f is not enough, though. You must +explicitly instantiate your classes. This is to allow you a +chance to add your own methods to the class. For a class +named "myCallback", it would look like this: + + declare-myCallback + end-myCallback + +You also have to define the "init" function for the class. +Most of the time this will work fine: + + declare-myCallback + use-default-init + end-myCallback + + +The "default" init function calls the super class's init +function, then sets all data members to 0. If this isn't +what you want, roll your own. The init function takes +the usual 2-cell "this" pointer as its argument: + + declare-myCallback + : init ( 2:this ) ... + ; + end-myCallback + +For a do-nothing init function, you'll want this: + + declare-myCallback + : init 2drop ; + end-myCallback + + +Here's a random example from the simple game I'm working on: + +----------------------------------------------------------------- +skinStream = xMethod("stream", "void").setVirtual(1) +gjeSkin.addMethod(skinStream) + +## +## gjeTexture +## +## +gjeTexture = xClass("gjeTexture") +gjeTexture.setParent(gjeSkin) +gjeTexture.addMethod(skinStream) +gjeTexture.addMethod(xMethod("clear", "void")) +gjeTexture.addMember(xVariable("texture", "LPDIRECT3DTEXTURE8")) +gjeTexture.addMember(xVariable("name", "char *")) +gjeTexture.addMember(xVariable("variation", "int")) +gjeTexture.addMember(xVariable("material", "D3DMATERIAL8 *")) + +----------------------------------------------------------------- + +I sure hope that's enough to get you started. + + + +Random notes: +* XClasses doesn't deal well with struct-packing issues. It assumes + pretty much everything will be 4-byte aligned. This can bite you + if you add a 64-bit int... the C compiler may align it for you, + and XClasses won't know about it. (This could be fixed in a future + release... are you volunteering?) For now, it's best to declare + your classes such that 64-bit ints are naturally 8-byte aligned. + +* If you don't want to have to declare each class in turn, + you can add something like this to the end of your Python script: +----- +def declare(name): + xAddFiclFooter("\t\"" + name + ".constant\" \" sfind swap drop 0= [if] declare-" + name + " use-default-init end-" + name + " [endif] \" evaluate") + + +xAddFiclFooter(": xclassesDeclare") +for c in classes: + declare(c.name) +xAddFiclFooter("\t;") +----- + and then call "xclassesDeclare" from your Ficl script just after + including "xclasses.f". + + +--lch +larry@hastings.org Added: vendor/ficl/dist/contrib/xclasses/xclasses.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/xclasses.py Mon May 11 14:02:38 2015 (r282768) @@ -0,0 +1,870 @@ +import copy +import string +import sys +import time +import types + + +def capitalize(s): + return string.upper(s[0]) + s[1:] + +def fprint(f, s): + print >> f, s + + +def fprintHeader(f, comment = "//"): + fprint(f, comment) + fprint(f, comment + " Generated by xclasses.py at " + time.strftime("%Y/%m/%d %H:%M:%S")) + fprint(f, comment) + fprint(f, comment) + fprint(f, "") + +def fprintFooter(f, comment = "//"): + fprint(f, "") + fprint(f, "") + fprint(f, comment + " end of file") + fprint(f, "") + +multicallCallTypeFunction = 0 +multicallCallTypeMethod = 1 +multicallCallTypeVirtualMethod = 2 + +multicallReturnTypeVoid = 0 +multicallReturnTypeInteger = 16 +multicallReturnTypeCstring = 32 +multicallReturnTypeFloat = 48 + +multicallExplicitVtable = 512 + + +ficlVmName = "ficlVm" + +h_headers = [] +def xAddHHeader(line): + h_headers.append(line) + +h_footers = [] +def xAddHFooter(line): + h_footers.append(line) + +ficl_headers = [] +def xAddFiclHeader(line): + ficl_headers.append(line) + +ficl_footers = [] +def xAddFiclFooter(line): + ficl_footers.append(line) + +c_headers = [] +def xAddCHeader(line): + c_headers.append(line) + +c_footers = [] +def xAddCFooter(line): + c_footers.append(line) + + +classes = [] + +class xVariable: + def __init__(self, name, typeCPP = None, cells = None, count = None, defaultValue = None, cstring = None): + self.comments = [] + self.setName(name) + self.setCells(cells) + self.setCount(count) + self.setDefaultValue(defaultValue) + self.setCString(cstring) + self.setTypeCPP(typeCPP) + + def setName(self, name): + self.name = name + return self + + def setTypeCPP(self, typeCPP): + self.typeCPP = typeCPP + if (typeCPP == "char *"): + self.setCString(1) + return self + + def setCells(self, cells): + if cells == None: + self.cells = 1 + else: + self.cells = cells + return self + + def setCString(self, cstring): + self.cstring = cstring + return self + + def isCString(self): + return self.cstring + + def getTotalSize(self): + return self.cells * self.count + + def setCount(self, count): + if type(count) != types.IntType: + count = 1 + self.count = count + return self + + def setDefaultValue(self, defaultValue): + if (defaultValue != None) and (type(defaultValue) != types.StringType): + defaultValue = str(defaultValue) + self.defaultValue = defaultValue + return self + + def addComment(self, c): + self.comments.append(c) + return self + + def isFloat(self): + return self.typeCPP == "float" + + def stringCPP(self, wantDefaultValues=1): + if (type(self.typeCPP) != types.StringType): + sys.exit("didn't set a CPP type on variable " + self.name + "!") + output = self.typeCPP + if (self.typeCPP[-1] != "*") and (self.typeCPP[-1] != "&"): + output += " " + output += self.name + if self.count > 1: + output += "[" + str(self.count) + "]" + if self.count == 0: + output += "[]" + if wantDefaultValues and (self.defaultValue != None): + output += " = " + self.defaultValue + return output + + def printH(self, f): + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + self.stringCPP() + ";") + + def printF(self, f): + totalCells = self.count * self.cells + if (totalCells <= 1): + typeF = "cell:" + else: + typeF = str(totalCells) + " cells:" + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + "S\" " + typeF + " ." + self.name + " \" evaluate") + + +class xMethod: + def __init__(self, name, returnType = None, virtual = None, static = None, body = None): + self.arguments = [] + self.comments = [] + + self.setName(name) + self.setReturnType(returnType) + self.setVirtual(virtual) + self.setStatic(static) + self.setBody(body) + self.setThunkVariable(None) + self.vtableOffset = 0 + + def copy(): + clone = xMethod(self.name, self.returnType, self.virtual, self.static) + clone.arguments = self.arguments + clone.comments = self.comments + + def setName(self, name): + self.name = name + return self + + def setReturnType(self, returnType): + if returnType.__class__ == xVariable: + self.returnType = returnType + elif type(returnType) == types.StringType: + self.returnType = xVariable("ignored", returnType) + else: + self.returnType = None + return self + + def returnTypeIsVoid(self): + return(self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") or (self.returnType.typeCPP == "void") + + def setVirtual(self, virtual): + self.virtual = virtual + return self + + def isVirtual(self): + return self.virtual > 0 + + def isPureVirtual(self): + return self.virtual > 1 + + def setStatic(self, static): + self.static = static + return self + + def setThunkVariable(self, thunkVariable): + self.thunkVariable = thunkVariable + return self + + def isStatic(self): + return self.static + + # a constructor or a destructor + def isClassSpecial(self): + return (self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") + + def setBody(self, body): + self.body = body + return self + + def addArgument(self, argument): + self.arguments.append(argument) + return self + + def addComment(self, c): + self.comments.append(c) + return self + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Mon May 11 14:07:49 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 61811E51; Mon, 11 May 2015 14:07:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 364821750; Mon, 11 May 2015 14:07:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4BE7nvi074702; Mon, 11 May 2015 14:07:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4BE7ng1074701; Mon, 11 May 2015 14:07:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505111407.t4BE7ng1074701@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Mon, 11 May 2015 14:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282769 - vendor/ficl/4.1.0 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 May 2015 14:07:49 -0000 Author: pfg Date: Mon May 11 14:07:48 2015 New Revision: 282769 URL: https://svnweb.freebsd.org/changeset/base/282769 Log: Tag ficl 4.1.0 Added: vendor/ficl/4.1.0/ - copied from r282768, vendor/ficl/dist/ From owner-svn-src-vendor@FreeBSD.ORG Tue May 12 02:28:15 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id EE77C8F2; Tue, 12 May 2015 02:28:15 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C34241E9C; Tue, 12 May 2015 02:28:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4C2SFRf041465; Tue, 12 May 2015 02:28:15 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4C2SFjd041464; Tue, 12 May 2015 02:28:15 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505120228.t4C2SFjd041464@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 May 2015 02:28:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282800 - vendor/ficl X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 02:28:16 -0000 Author: pfg Date: Tue May 12 02:28:15 2015 New Revision: 282800 URL: https://svnweb.freebsd.org/changeset/base/282800 Log: Revert r282768, r282769: Reset ficl - it will be reimported cleanly from 3.0.3. Deleted: vendor/ficl/ Modified: Directory Properties: vendor/ (props changed) From owner-svn-src-vendor@FreeBSD.ORG Tue May 12 02:36:35 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 042E1AC4; Tue, 12 May 2015 02:36:35 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E404A1F79; Tue, 12 May 2015 02:36:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4C2aYNv046138; Tue, 12 May 2015 02:36:34 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4C2aYul046134; Tue, 12 May 2015 02:36:34 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505120236.t4C2aYul046134@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 May 2015 02:36:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282801 - in vendor/ficl: . dist dist/doc dist/softwords dist/test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 02:36:35 -0000 Author: pfg Date: Tue May 12 02:36:33 2015 New Revision: 282801 URL: https://svnweb.freebsd.org/changeset/base/282801 Log: Bring ficl to the vendor area. We currently use ficl3 in ~sys/boot/ficl but it has a bunch of local changes. WWW: http://ficl.sourceforge.net/ Discussed with: dteske, mr Added: vendor/ficl/ vendor/ficl/dist/ vendor/ficl/dist/Makefile.linux (contents, props changed) vendor/ficl/dist/ReadMe.txt (contents, props changed) vendor/ficl/dist/dict.c (contents, props changed) vendor/ficl/dist/doc/ vendor/ficl/dist/doc/Logo.jpg (contents, props changed) vendor/ficl/dist/doc/favicon.ico (contents, props changed) vendor/ficl/dist/doc/ficl.html (contents, props changed) vendor/ficl/dist/doc/ficl1.ico (contents, props changed) vendor/ficl/dist/doc/ficl_debug.html (contents, props changed) vendor/ficl/dist/doc/ficl_guts.htm vendor/ficl/dist/doc/ficl_loc.html (contents, props changed) vendor/ficl/dist/doc/ficl_logo.jpg (contents, props changed) vendor/ficl/dist/doc/ficl_oop.html (contents, props changed) vendor/ficl/dist/doc/ficl_oop.jpg (contents, props changed) vendor/ficl/dist/doc/ficl_parse.html (contents, props changed) vendor/ficl/dist/doc/ficl_rel.html (contents, props changed) vendor/ficl/dist/doc/ficl_top.jpg (contents, props changed) vendor/ficl/dist/doc/ficlddj.PDF (contents, props changed) vendor/ficl/dist/doc/ficlheader.js vendor/ficl/dist/doc/index.html (contents, props changed) vendor/ficl/dist/doc/jwsforml.PDF (contents, props changed) vendor/ficl/dist/doc/oo_in_c.html (contents, props changed) vendor/ficl/dist/doc/primer.txt (contents, props changed) vendor/ficl/dist/doc/sigplan9906.doc (contents, props changed) vendor/ficl/dist/doc/skey.gif (contents, props changed) vendor/ficl/dist/ficl.c (contents, props changed) vendor/ficl/dist/ficl.dsp vendor/ficl/dist/ficl.dsw vendor/ficl/dist/ficl.h (contents, props changed) vendor/ficl/dist/fileaccess.c (contents, props changed) vendor/ficl/dist/float.c (contents, props changed) vendor/ficl/dist/math64.c (contents, props changed) vendor/ficl/dist/math64.h (contents, props changed) vendor/ficl/dist/prefix.c (contents, props changed) vendor/ficl/dist/search.c (contents, props changed) vendor/ficl/dist/softcore.c (contents, props changed) vendor/ficl/dist/softwords/ vendor/ficl/dist/softwords/classes.fr vendor/ficl/dist/softwords/ficlclass.fr vendor/ficl/dist/softwords/ficllocal.fr vendor/ficl/dist/softwords/fileaccess.fr vendor/ficl/dist/softwords/forml.fr vendor/ficl/dist/softwords/ifbrack.fr vendor/ficl/dist/softwords/jhlocal.fr vendor/ficl/dist/softwords/makefile (contents, props changed) vendor/ficl/dist/softwords/marker.fr vendor/ficl/dist/softwords/oo.fr vendor/ficl/dist/softwords/oo.fr.bak vendor/ficl/dist/softwords/prefix.fr vendor/ficl/dist/softwords/softcore.bat vendor/ficl/dist/softwords/softcore.fr vendor/ficl/dist/softwords/softcore.pl (contents, props changed) vendor/ficl/dist/softwords/softcore.py (contents, props changed) vendor/ficl/dist/softwords/softcore.py.bat vendor/ficl/dist/softwords/string.fr vendor/ficl/dist/softwords/win32.fr vendor/ficl/dist/stack.c (contents, props changed) vendor/ficl/dist/sysdep.c (contents, props changed) vendor/ficl/dist/sysdep.h (contents, props changed) vendor/ficl/dist/test/ vendor/ficl/dist/test/asm68k.4th vendor/ficl/dist/test/core.fr vendor/ficl/dist/test/fib.fr vendor/ficl/dist/test/ficltest.fr vendor/ficl/dist/test/ooptest.fr vendor/ficl/dist/test/prefix.fr vendor/ficl/dist/test/sarray.fr vendor/ficl/dist/test/testcase.fr vendor/ficl/dist/test/tester.fr vendor/ficl/dist/test/vocab.fr vendor/ficl/dist/testmain.c (contents, props changed) vendor/ficl/dist/tools.c (contents, props changed) vendor/ficl/dist/unix.c (contents, props changed) vendor/ficl/dist/vm.c (contents, props changed) vendor/ficl/dist/win32.c (contents, props changed) vendor/ficl/dist/words.c (contents, props changed) Added: vendor/ficl/dist/Makefile.linux ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile.linux Tue May 12 02:36:33 2015 (r282801) @@ -0,0 +1,52 @@ +OBJECTS= dict.o ficl.o fileaccess.o float.o math64.o prefix.o search.o softcore.o stack.o sysdep.o tools.o unix.o vm.o words.o +HEADERS= ficl.h math64.h sysdep.h +# +# Flags for shared library +TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O -c $(SHFLAGS) $(TARGET) +CC=gcc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 3 +MINOR = 0.1 + +ficl: testmain.o ficl.h sysdep.h libficl.a + $(CC) testmain.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +testmain: testmain.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) testmain.o -o testmain -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) -c $*.c + +.cxx.o: + $(CPP) $(CPFLAGS) -c $*.cxx + +.cc.o: + $(CPP) $(CPFLAGS) -c $*.cc +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Added: vendor/ficl/dist/ReadMe.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/ReadMe.txt Tue May 12 02:36:33 2015 (r282801) @@ -0,0 +1,49 @@ +FICL 3.03 +April 2002 + +________ +OVERVIEW + +Ficl is a complete programming language interpreter designed to be embedded +into other systems (including firmware based ones) as a command, macro, +and development prototype language. Ficl stands for "Forth Inspired +Command Language". + +For more information, please see the "doc" directory. +For release notes, please see "doc/ficl_rel.html". + +____________ +INSTALLATION + +Ficl builds out-of-the-box on the following platforms: + * Linux: use "Makefile.linux". + * RiscOS: use "Makefile.riscos". + * Win32: use "ficl.dsw" / "ficl.dsp". +To port to other platforms, be sure to examine "sysdep.h", and +we suggest you start with the Linux makefile. (And please--feel +free to submit your portability changes!) + +____________ +FICL LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + Added: vendor/ficl/dist/dict.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/dict.c Tue May 12 02:36:33 2015 (r282801) @@ -0,0 +1,836 @@ +/******************************************************************* +** d i c t . c +** Forth Inspired Command Language - dictionary methods +** Author: John Sadler (john_sadler@alum.mit.edu) +** Created: 19 July 1997 +** $Id: dict.c,v 1.12 2001-10-28 10:59:22-08 jsadler Exp jsadler $ +*******************************************************************/ +/* +** This file implements the dictionary -- FICL's model of +** memory management. All FICL words are stored in the +** dictionary. A word is a named chunk of data with its +** associated code. FICL treats all words the same, even +** precompiled ones, so your words become first-class +** extensions of the language. You can even define new +** control structures. +** +** 29 jun 1998 (sadler) added variable sized hash table support +*/ +/* +** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu) +** All rights reserved. +** +** Get the latest Ficl release at http://ficl.sourceforge.net +** +** I am interested in hearing from anyone who uses ficl. If you have +** a problem, a success story, a defect, an enhancement request, or +** if you would like to contribute to the ficl release, please +** contact me by email at the address above. +** +** L I C E N S E and D I S C L A I M E R +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +*/ + +#include +#include /* sprintf */ +#include +#include +#include "ficl.h" + +static char *dictCopyName(FICL_DICT *pDict, STRINGINFO si); + +/************************************************************************** + d i c t A b o r t D e f i n i t i o n +** Abort a definition in process: reclaim its memory and unlink it +** from the dictionary list. Assumes that there is a smudged +** definition in process...otherwise does nothing. +** NOTE: this function is not smart enough to unlink a word that +** has been successfully defined (ie linked into a hash). It +** only works for defs in process. If the def has been unsmudged, +** nothing happens. +**************************************************************************/ +void dictAbortDefinition(FICL_DICT *pDict) +{ + FICL_WORD *pFW; + ficlLockDictionary(TRUE); + pFW = pDict->smudge; + + if (pFW->flags & FW_SMUDGE) + pDict->here = (CELL *)pFW->name; + + ficlLockDictionary(FALSE); + return; +} + + +/************************************************************************** + a l i g n P t r +** Aligns the given pointer to FICL_ALIGN address units. +** Returns the aligned pointer value. +**************************************************************************/ +void *alignPtr(void *ptr) +{ +#if FICL_ALIGN > 0 + char *cp; + CELL c; + cp = (char *)ptr + FICL_ALIGN_ADD; + c.p = (void *)cp; + c.u = c.u & (~FICL_ALIGN_ADD); + ptr = (CELL *)c.p; +#endif + return ptr; +} + + +/************************************************************************** + d i c t A l i g n +** Align the dictionary's free space pointer +**************************************************************************/ +void dictAlign(FICL_DICT *pDict) +{ + pDict->here = alignPtr(pDict->here); +} + + +/************************************************************************** + d i c t A l l o t +** Allocate or remove n chars of dictionary space, with +** checks for underrun and overrun +**************************************************************************/ +int dictAllot(FICL_DICT *pDict, int n) +{ + char *cp = (char *)pDict->here; +#if FICL_ROBUST + if (n > 0) + { + if ((unsigned)n <= dictCellsAvail(pDict) * sizeof (CELL)) + cp += n; + else + return 1; /* dict is full */ + } + else + { + n = -n; + if ((unsigned)n <= dictCellsUsed(pDict) * sizeof (CELL)) + cp -= n; + else /* prevent underflow */ + cp -= dictCellsUsed(pDict) * sizeof (CELL); + } +#else + cp += n; +#endif + pDict->here = PTRtoCELL cp; + return 0; +} + + +/************************************************************************** + d i c t A l l o t C e l l s +** Reserve space for the requested number of cells in the +** dictionary. If nCells < 0 , removes space from the dictionary. +**************************************************************************/ +int dictAllotCells(FICL_DICT *pDict, int nCells) +{ +#if FICL_ROBUST + if (nCells > 0) + { + if (nCells <= dictCellsAvail(pDict)) + pDict->here += nCells; + else + return 1; /* dict is full */ + } + else + { + nCells = -nCells; + if (nCells <= dictCellsUsed(pDict)) + pDict->here -= nCells; + else /* prevent underflow */ + pDict->here -= dictCellsUsed(pDict); + } +#else + pDict->here += nCells; +#endif + return 0; +} + + +/************************************************************************** + d i c t A p p e n d C e l l +** Append the specified cell to the dictionary +**************************************************************************/ +void dictAppendCell(FICL_DICT *pDict, CELL c) +{ + *pDict->here++ = c; + return; +} + + +/************************************************************************** + d i c t A p p e n d C h a r +** Append the specified char to the dictionary +**************************************************************************/ +void dictAppendChar(FICL_DICT *pDict, char c) +{ + char *cp = (char *)pDict->here; + *cp++ = c; + pDict->here = PTRtoCELL cp; + return; +} + + +/************************************************************************** + d i c t A p p e n d W o r d +** Create a new word in the dictionary with the specified +** name, code, and flags. Name must be NULL-terminated. +**************************************************************************/ +FICL_WORD *dictAppendWord(FICL_DICT *pDict, + char *name, + FICL_CODE pCode, + UNS8 flags) +{ + STRINGINFO si; + SI_SETLEN(si, strlen(name)); + SI_SETPTR(si, name); + return dictAppendWord2(pDict, si, pCode, flags); +} + + +/************************************************************************** + d i c t A p p e n d W o r d 2 +** Create a new word in the dictionary with the specified +** STRINGINFO, code, and flags. Does not require a NULL-terminated +** name. +**************************************************************************/ +FICL_WORD *dictAppendWord2(FICL_DICT *pDict, + STRINGINFO si, + FICL_CODE pCode, + UNS8 flags) +{ + FICL_COUNT len = (FICL_COUNT)SI_COUNT(si); + char *pName; + FICL_WORD *pFW; + + ficlLockDictionary(TRUE); + + /* + ** NOTE: dictCopyName advances "here" as a side-effect. + ** It must execute before pFW is initialized. + */ + pName = dictCopyName(pDict, si); + pFW = (FICL_WORD *)pDict->here; + pDict->smudge = pFW; + pFW->hash = hashHashCode(si); + pFW->code = pCode; + pFW->flags = (UNS8)(flags | FW_SMUDGE); + pFW->nName = (char)len; + pFW->name = pName; + /* + ** Point "here" to first cell of new word's param area... + */ + pDict->here = pFW->param; + + if (!(flags & FW_SMUDGE)) + dictUnsmudge(pDict); + + ficlLockDictionary(FALSE); + return pFW; +} + + +/************************************************************************** + d i c t A p p e n d U N S +** Append the specified FICL_UNS to the dictionary +**************************************************************************/ +void dictAppendUNS(FICL_DICT *pDict, FICL_UNS u) +{ + *pDict->here++ = LVALUEtoCELL(u); + return; +} + + +/************************************************************************** + d i c t C e l l s A v a i l +** Returns the number of empty cells left in the dictionary +**************************************************************************/ +int dictCellsAvail(FICL_DICT *pDict) +{ + return pDict->size - dictCellsUsed(pDict); +} + + +/************************************************************************** + d i c t C e l l s U s e d +** Returns the number of cells consumed in the dicionary +**************************************************************************/ +int dictCellsUsed(FICL_DICT *pDict) +{ + return pDict->here - pDict->dict; +} + + +/************************************************************************** + d i c t C h e c k +** Checks the dictionary for corruption and throws appropriate +** errors. +** Input: +n number of ADDRESS UNITS (not Cells) proposed to allot +** -n number of ADDRESS UNITS proposed to de-allot +** 0 just do a consistency check +**************************************************************************/ +void dictCheck(FICL_DICT *pDict, FICL_VM *pVM, int n) +{ + if ((n >= 0) && (dictCellsAvail(pDict) * (int)sizeof(CELL) < n)) + { + vmThrowErr(pVM, "Error: dictionary full"); + } + + if ((n <= 0) && (dictCellsUsed(pDict) * (int)sizeof(CELL) < -n)) + { + vmThrowErr(pVM, "Error: dictionary underflow"); + } + + if (pDict->nLists > FICL_DEFAULT_VOCS) + { + dictResetSearchOrder(pDict); + vmThrowErr(pVM, "Error: search order overflow"); + } + else if (pDict->nLists < 0) + { + dictResetSearchOrder(pDict); + vmThrowErr(pVM, "Error: search order underflow"); + } + + return; +} + + +/************************************************************************** + d i c t C o p y N a m e +** Copy up to nFICLNAME characters of the name specified by si into +** the dictionary starting at "here", then NULL-terminate the name, +** point "here" to the next available byte, and return the address of +** the beginning of the name. Used by dictAppendWord. +** N O T E S : +** 1. "here" is guaranteed to be aligned after this operation. +** 2. If the string has zero length, align and return "here" +**************************************************************************/ +static char *dictCopyName(FICL_DICT *pDict, STRINGINFO si) +{ + char *oldCP = (char *)pDict->here; + char *cp = oldCP; + char *name = SI_PTR(si); + int i = SI_COUNT(si); + + if (i == 0) + { + dictAlign(pDict); + return (char *)pDict->here; + } + + if (i > nFICLNAME) + i = nFICLNAME; + + for (; i > 0; --i) + { + *cp++ = *name++; + } + + *cp++ = '\0'; + + pDict->here = PTRtoCELL cp; + dictAlign(pDict); + return oldCP; +} + + +/************************************************************************** + d i c t C r e a t e +** Create and initialize a dictionary with the specified number +** of cells capacity, and no hashing (hash size == 1). +**************************************************************************/ +FICL_DICT *dictCreate(unsigned nCells) +{ + return dictCreateHashed(nCells, 1); +} + + +FICL_DICT *dictCreateHashed(unsigned nCells, unsigned nHash) +{ + FICL_DICT *pDict; + size_t nAlloc; + + nAlloc = sizeof (FICL_DICT) + nCells * sizeof (CELL) + + sizeof (FICL_HASH) + (nHash - 1) * sizeof (FICL_WORD *); + + pDict = ficlMalloc(nAlloc); + assert(pDict); + + pDict->size = nCells; + dictEmpty(pDict, nHash); + return pDict; +} + + +/************************************************************************** + d i c t C r e a t e W o r d l i s t +** Create and initialize an anonymous wordlist +**************************************************************************/ +FICL_HASH *dictCreateWordlist(FICL_DICT *dp, int nBuckets) +{ + FICL_HASH *pHash; + + dictAlign(dp); + pHash = (FICL_HASH *)dp->here; + dictAllot(dp, sizeof (FICL_HASH) + + (nBuckets-1) * sizeof (FICL_WORD *)); + + pHash->size = nBuckets; + hashReset(pHash); + return pHash; +} + + +/************************************************************************** + d i c t D e l e t e +** Free all memory allocated for the given dictionary +**************************************************************************/ +void dictDelete(FICL_DICT *pDict) +{ + assert(pDict); + ficlFree(pDict); + return; +} + + +/************************************************************************** + d i c t E m p t y +** Empty the dictionary, reset its hash table, and reset its search order. +** Clears and (re-)creates the hash table with the size specified by nHash. +**************************************************************************/ +void dictEmpty(FICL_DICT *pDict, unsigned nHash) +{ + FICL_HASH *pHash; + + pDict->here = pDict->dict; + + dictAlign(pDict); + pHash = (FICL_HASH *)pDict->here; + dictAllot(pDict, + sizeof (FICL_HASH) + (nHash - 1) * sizeof (FICL_WORD *)); + + pHash->size = nHash; + hashReset(pHash); + + pDict->pForthWords = pHash; + pDict->smudge = NULL; + dictResetSearchOrder(pDict); + return; +} + + +/************************************************************************** + d i c t H a s h S u m m a r y +** Calculate a figure of merit for the dictionary hash table based +** on the average search depth for all the words in the dictionary, +** assuming uniform distribution of target keys. The figure of merit +** is the ratio of the total search depth for all keys in the table +** versus a theoretical optimum that would be achieved if the keys +** were distributed into the table as evenly as possible. +** The figure would be worse if the hash table used an open +** addressing scheme (i.e. collisions resolved by searching the +** table for an empty slot) for a given size table. +**************************************************************************/ +#if FICL_WANT_FLOAT +void dictHashSummary(FICL_VM *pVM) +{ + FICL_DICT *dp = vmGetDict(pVM); + FICL_HASH *pFHash; + FICL_WORD **pHash; + unsigned size; + FICL_WORD *pFW; + unsigned i; + int nMax = 0; + int nWords = 0; + int nFilled; + double avg = 0.0; + double best; + int nAvg, nRem, nDepth; + + dictCheck(dp, pVM, 0); + + pFHash = dp->pSearch[dp->nLists - 1]; + pHash = pFHash->table; + size = pFHash->size; + nFilled = size; + + for (i = 0; i < size; i++) + { + int n = 0; + pFW = pHash[i]; + + while (pFW) + { + ++n; + ++nWords; + pFW = pFW->link; + } + + avg += (double)(n * (n+1)) / 2.0; + + if (n > nMax) + nMax = n; + if (n == 0) + --nFilled; + } + + /* Calc actual avg search depth for this hash */ + avg = avg / nWords; + + /* Calc best possible performance with this size hash */ + nAvg = nWords / size; + nRem = nWords % size; + nDepth = size * (nAvg * (nAvg+1))/2 + (nAvg+1)*nRem; + best = (double)nDepth/nWords; + + sprintf(pVM->pad, + "%d bins, %2.0f%% filled, Depth: Max=%d, Avg=%2.1f, Best=%2.1f, Score: %2.0f%%", + size, + (double)nFilled * 100.0 / size, nMax, + avg, + best, + 100.0 * best / avg); + + ficlTextOut(pVM, pVM->pad, 1); + + return; +} +#endif + +/************************************************************************** + d i c t I n c l u d e s +** Returns TRUE iff the given pointer is within the address range of +** the dictionary. +**************************************************************************/ +int dictIncludes(FICL_DICT *pDict, void *p) +{ + return ((p >= (void *) &pDict->dict) + && (p < (void *)(&pDict->dict + pDict->size)) + ); +} + + +/************************************************************************** + d i c t L o o k u p +** Find the FICL_WORD that matches the given name and length. +** If found, returns the word's address. Otherwise returns NULL. +** Uses the search order list to search multiple wordlists. +**************************************************************************/ +FICL_WORD *dictLookup(FICL_DICT *pDict, STRINGINFO si) +{ + FICL_WORD *pFW = NULL; + FICL_HASH *pHash; + int i; + UNS16 hashCode = hashHashCode(si); + + assert(pDict); + + ficlLockDictionary(1); + + for (i = (int)pDict->nLists - 1; (i >= 0) && (!pFW); --i) + { + pHash = pDict->pSearch[i]; + pFW = hashLookup(pHash, si, hashCode); + } + + ficlLockDictionary(0); + return pFW; +} + + +/************************************************************************** + f i c l L o o k u p L o c +** Same as dictLookup, but looks in system locals dictionary first... +** Assumes locals dictionary has only one wordlist... +**************************************************************************/ +#if FICL_WANT_LOCALS +FICL_WORD *ficlLookupLoc(FICL_SYSTEM *pSys, STRINGINFO si) +{ + FICL_WORD *pFW = NULL; + FICL_DICT *pDict = pSys->dp; + FICL_HASH *pHash = ficlGetLoc(pSys)->pForthWords; + int i; + UNS16 hashCode = hashHashCode(si); + + assert(pHash); + assert(pDict); + + ficlLockDictionary(1); + /* + ** check the locals dict first... + */ + pFW = hashLookup(pHash, si, hashCode); + + /* + ** If no joy, (!pFW) --------------------------v + ** iterate over the search list in the main dict + */ + for (i = (int)pDict->nLists - 1; (i >= 0) && (!pFW); --i) + { + pHash = pDict->pSearch[i]; + pFW = hashLookup(pHash, si, hashCode); + } + + ficlLockDictionary(0); + return pFW; +} +#endif + + +/************************************************************************** + d i c t R e s e t S e a r c h O r d e r +** Initialize the dictionary search order list to sane state +**************************************************************************/ +void dictResetSearchOrder(FICL_DICT *pDict) +{ + assert(pDict); + pDict->pCompile = pDict->pForthWords; + pDict->nLists = 1; + pDict->pSearch[0] = pDict->pForthWords; + return; +} + + +/************************************************************************** + d i c t S e t F l a g s +** Changes the flags field of the most recently defined word: +** Set all bits that are ones in the set parameter, clear all bits +** that are ones in the clr parameter. Clear wins in case the same bit +** is set in both parameters. +**************************************************************************/ +void dictSetFlags(FICL_DICT *pDict, UNS8 set, UNS8 clr) +{ + assert(pDict->smudge); + pDict->smudge->flags |= set; + pDict->smudge->flags &= ~clr; + return; +} + + +/************************************************************************** + d i c t S e t I m m e d i a t e +** Set the most recently defined word as IMMEDIATE +**************************************************************************/ +void dictSetImmediate(FICL_DICT *pDict) +{ + assert(pDict->smudge); + pDict->smudge->flags |= FW_IMMEDIATE; + return; +} + + +/************************************************************************** + d i c t U n s m u d g e +** Completes the definition of a word by linking it +** into the main list +**************************************************************************/ +void dictUnsmudge(FICL_DICT *pDict) +{ + FICL_WORD *pFW = pDict->smudge; + FICL_HASH *pHash = pDict->pCompile; + + assert(pHash); + assert(pFW); + /* + ** :noname words never get linked into the list... + */ + if (pFW->nName > 0) + hashInsertWord(pHash, pFW); + pFW->flags &= ~(FW_SMUDGE); + return; +} + + +/************************************************************************** + d i c t W h e r e +** Returns the value of the HERE pointer -- the address +** of the next free cell in the dictionary +**************************************************************************/ +CELL *dictWhere(FICL_DICT *pDict) +{ + return pDict->here; +} + + +/************************************************************************** + h a s h F o r g e t +** Unlink all words in the hash that have addresses greater than or +** equal to the address supplied. Implementation factor for FORGET +** and MARKER. +**************************************************************************/ +void hashForget(FICL_HASH *pHash, void *where) +{ + FICL_WORD *pWord; + unsigned i; + + assert(pHash); + assert(where); + + for (i = 0; i < pHash->size; i++) + { + pWord = pHash->table[i]; + + while ((void *)pWord >= where) + { + pWord = pWord->link; + } + + pHash->table[i] = pWord; + } + + return; +} + + +/************************************************************************** + h a s h H a s h C o d e +** +** Generate a 16 bit hashcode from a character string using a rolling +** shift and add stolen from PJ Weinberger of Bell Labs fame. Case folds +** the name before hashing it... +** N O T E : If string has zero length, returns zero. +**************************************************************************/ +UNS16 hashHashCode(STRINGINFO si) +{ + /* hashPJW */ + UNS8 *cp; + UNS16 code = (UNS16)si.count; + UNS16 shift = 0; + + if (si.count == 0) + return 0; + + /* changed to run without errors under Purify -- lch */ + for (cp = (UNS8 *)si.cp; si.count && *cp; cp++, si.count--) + { + code = (UNS16)((code << 4) + tolower(*cp)); + shift = (UNS16)(code & 0xf000); + if (shift) + { + code ^= (UNS16)(shift >> 8); + code ^= (UNS16)shift; + } + } + + return (UNS16)code; +} + + + + +/************************************************************************** + h a s h I n s e r t W o r d +** Put a word into the hash table using the word's hashcode as +** an index (modulo the table size). +**************************************************************************/ +void hashInsertWord(FICL_HASH *pHash, FICL_WORD *pFW) +{ + FICL_WORD **pList; + + assert(pHash); + assert(pFW); + + if (pHash->size == 1) + { + pList = pHash->table; + } + else + { + pList = pHash->table + (pFW->hash % pHash->size); + } + + pFW->link = *pList; + *pList = pFW; + return; +} + + +/************************************************************************** + h a s h L o o k u p +** Find a name in the hash table given the hashcode and text of the name. +** Returns the address of the corresponding FICL_WORD if found, +** otherwise NULL. +** Note: outer loop on link field supports inheritance in wordlists. +** It's not part of ANS Forth - ficl only. hashReset creates wordlists +** with NULL link fields. +**************************************************************************/ +FICL_WORD *hashLookup(FICL_HASH *pHash, STRINGINFO si, UNS16 hashCode) +{ + FICL_UNS nCmp = si.count; + FICL_WORD *pFW; + UNS16 hashIdx; + + if (nCmp > nFICLNAME) + nCmp = nFICLNAME; + + for (; pHash != NULL; pHash = pHash->link) + { + if (pHash->size > 1) + hashIdx = (UNS16)(hashCode % pHash->size); + else /* avoid the modulo op for single threaded lists */ + hashIdx = 0; + + for (pFW = pHash->table[hashIdx]; pFW; pFW = pFW->link) + { + if ( (pFW->nName == si.count) + && (!strincmp(si.cp, pFW->name, nCmp)) ) + return pFW; +#if FICL_ROBUST + assert(pFW != pFW->link); +#endif + } + } + + return NULL; +} + + +/************************************************************************** + h a s h R e s e t +** Initialize a FICL_HASH to empty state. +**************************************************************************/ +void hashReset(FICL_HASH *pHash) +{ + unsigned i; + + assert(pHash); + + for (i = 0; i < pHash->size; i++) + { + pHash->table[i] = NULL; + } + + pHash->link = NULL; + pHash->name = NULL; + return; +} + + Added: vendor/ficl/dist/doc/Logo.jpg ============================================================================== Binary file. No diff available. Added: vendor/ficl/dist/doc/favicon.ico ============================================================================== Binary file. No diff available. Added: vendor/ficl/dist/doc/ficl.html ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/doc/ficl.html Tue May 12 02:36:33 2015 (r282801) @@ -0,0 +1,1519 @@ + + + + + + + + + + Ficl - Embedded Scripting + + + +

+ Ficl Documentation +

+ +
+
+ +

+ What is ficl? +

+ Ficl is a complete programming language interpreter designed to be embedded into other systems (including firmware based ones) as a command, macro, and development prototype language. Unlike other scripting interpreters, + Ficl: +
    +
  • + typically takes under 2 hours to port to a new system -- much less if the target operating system is one of several already supported (Win32, Linux, FreeBSD, RiscOS, and more) +
  • +
  • + has a small memory footprint: a fully featured Win32 console version takes less than 100K of memory, and a minimal version is less than half that +
  • +
  • + is relatively quick thanks to its threaded code virtual machine design and just in time compiling +
  • +
  • + is a complete and powerful programming language +
  • +
  • + is interactive +
  • +
  • + has object oriented programming features that can be used to wrap data structures or classes of the host system without altering them - even if the host is mainly written in a non-OO + language +
  • +
+

+ Ficl syntax is based on ANS Forth and the code is Standard C. See below for examples of software and products that include ficl. Ficl stands for "Forth inspired *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Tue May 12 02:38:49 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9FDE6C20; Tue, 12 May 2015 02:38:49 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 74A401FA5; Tue, 12 May 2015 02:38:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4C2cniF046427; Tue, 12 May 2015 02:38:49 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4C2cn7q046426; Tue, 12 May 2015 02:38:49 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505120238.t4C2cn7q046426@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 May 2015 02:38:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282802 - vendor/ficl/3.0.3 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 02:38:49 -0000 Author: pfg Date: Tue May 12 02:38:48 2015 New Revision: 282802 URL: https://svnweb.freebsd.org/changeset/base/282802 Log: Tag ficl 3.0.3 Added: vendor/ficl/3.0.3/ - copied from r282801, vendor/ficl/dist/ From owner-svn-src-vendor@FreeBSD.ORG Tue May 12 03:27:09 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9E47864B; Tue, 12 May 2015 03:27:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 893271663; Tue, 12 May 2015 03:27:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4C3R9ku071505; Tue, 12 May 2015 03:27:09 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4C3R7Hb071491; Tue, 12 May 2015 03:27:07 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505120327.t4C3R7Hb071491@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 May 2015 03:27:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282803 - in vendor/ficl/dist: . contrib contrib/xclasses doc doc/articles doc/graphics doc/source ficlplatform softcore softwords test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 03:27:09 -0000 Author: pfg Date: Tue May 12 03:27:06 2015 New Revision: 282803 URL: https://svnweb.freebsd.org/changeset/base/282803 Log: Update to ficl 4.1.0 (latest release on sourceforge) Added: vendor/ficl/dist/Makefile (contents, props changed) vendor/ficl/dist/Makefile.ansi (contents, props changed) vendor/ficl/dist/bit.c (contents, props changed) vendor/ficl/dist/callback.c (contents, props changed) vendor/ficl/dist/compatibility.c (contents, props changed) vendor/ficl/dist/contrib/ vendor/ficl/dist/contrib/xclasses/ vendor/ficl/dist/contrib/xclasses/readme.txt (contents, props changed) vendor/ficl/dist/contrib/xclasses/xclasses.py (contents, props changed) vendor/ficl/dist/dictionary.c - copied, changed from r282801, vendor/ficl/dist/dict.c vendor/ficl/dist/doc/api.html (contents, props changed) vendor/ficl/dist/doc/articles/ vendor/ficl/dist/doc/articles/ficlddj.pdf (contents, props changed) vendor/ficl/dist/doc/articles/jwsforml.pdf (contents, props changed) vendor/ficl/dist/doc/articles/oo_in_c.html (contents, props changed) vendor/ficl/dist/doc/articles/sigplan9906.doc (contents, props changed) vendor/ficl/dist/doc/debugger.html (contents, props changed) vendor/ficl/dist/doc/dpans.html (contents, props changed) vendor/ficl/dist/doc/graphics/ vendor/ficl/dist/doc/graphics/4ring.gif (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.128.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.64.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl.4.96.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_oop.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/ficl_top.jpg (contents, props changed) vendor/ficl/dist/doc/graphics/sourceforge.jpg (contents, props changed) vendor/ficl/dist/doc/license.html (contents, props changed) vendor/ficl/dist/doc/links.html (contents, props changed) vendor/ficl/dist/doc/locals.html (contents, props changed) vendor/ficl/dist/doc/oop.html (contents, props changed) vendor/ficl/dist/doc/parsesteps.html (contents, props changed) vendor/ficl/dist/doc/releases.html (contents, props changed) vendor/ficl/dist/doc/source/ vendor/ficl/dist/doc/source/api.ht vendor/ficl/dist/doc/source/debugger.ht vendor/ficl/dist/doc/source/dpans.ht vendor/ficl/dist/doc/source/ficl.ht vendor/ficl/dist/doc/source/generate.py (contents, props changed) vendor/ficl/dist/doc/source/index.ht vendor/ficl/dist/doc/source/license.ht vendor/ficl/dist/doc/source/links.ht vendor/ficl/dist/doc/source/locals.ht vendor/ficl/dist/doc/source/oop.ht vendor/ficl/dist/doc/source/parsesteps.ht vendor/ficl/dist/doc/source/releases.ht vendor/ficl/dist/doc/source/upgrading.ht vendor/ficl/dist/doc/upgrading.html (contents, props changed) vendor/ficl/dist/double.c - copied, changed from r282801, vendor/ficl/dist/math64.c vendor/ficl/dist/extras.c (contents, props changed) vendor/ficl/dist/ficlcompatibility.h (contents, props changed) vendor/ficl/dist/ficldll.def vendor/ficl/dist/ficldll.dsp vendor/ficl/dist/ficlexe.dsp vendor/ficl/dist/ficllib.dsp vendor/ficl/dist/ficllocal.h (contents, props changed) vendor/ficl/dist/ficlplatform/ vendor/ficl/dist/ficlplatform/alpha.h (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.c (contents, props changed) vendor/ficl/dist/ficlplatform/ansi.h (contents, props changed) vendor/ficl/dist/ficlplatform/ficlexports.txt (contents, props changed) vendor/ficl/dist/ficlplatform/makedef.py (contents, props changed) vendor/ficl/dist/ficlplatform/unix.c (contents, props changed) vendor/ficl/dist/ficlplatform/unix.h (contents, props changed) vendor/ficl/dist/ficlplatform/win32.c (contents, props changed) vendor/ficl/dist/ficlplatform/win32.h (contents, props changed) vendor/ficl/dist/ficltokens.h (contents, props changed) vendor/ficl/dist/hash.c (contents, props changed) vendor/ficl/dist/lzcompress.c (contents, props changed) vendor/ficl/dist/lzuncompress.c (contents, props changed) vendor/ficl/dist/main.c (contents, props changed) vendor/ficl/dist/primitives.c - copied, changed from r282801, vendor/ficl/dist/words.c vendor/ficl/dist/softcore/ - copied from r282801, vendor/ficl/dist/softwords/ vendor/ficl/dist/softcore/ficl.fr vendor/ficl/dist/softcore/make.bat vendor/ficl/dist/softcore/makesoftcore.c (contents, props changed) vendor/ficl/dist/system.c - copied, changed from r282801, vendor/ficl/dist/ficl.c vendor/ficl/dist/utility.c (contents, props changed) vendor/ficl/dist/word.c (contents, props changed) Deleted: vendor/ficl/dist/dict.c vendor/ficl/dist/doc/Logo.jpg vendor/ficl/dist/doc/ficl1.ico vendor/ficl/dist/doc/ficl_debug.html vendor/ficl/dist/doc/ficl_guts.htm vendor/ficl/dist/doc/ficl_loc.html vendor/ficl/dist/doc/ficl_logo.jpg vendor/ficl/dist/doc/ficl_oop.html vendor/ficl/dist/doc/ficl_oop.jpg vendor/ficl/dist/doc/ficl_parse.html vendor/ficl/dist/doc/ficl_rel.html vendor/ficl/dist/doc/ficl_top.jpg vendor/ficl/dist/doc/ficlddj.PDF vendor/ficl/dist/doc/ficlheader.js vendor/ficl/dist/doc/jwsforml.PDF vendor/ficl/dist/doc/oo_in_c.html vendor/ficl/dist/doc/primer.txt vendor/ficl/dist/doc/sigplan9906.doc vendor/ficl/dist/doc/skey.gif vendor/ficl/dist/ficl.c vendor/ficl/dist/ficl.dsp vendor/ficl/dist/math64.c vendor/ficl/dist/math64.h vendor/ficl/dist/softcore/oo.fr.bak vendor/ficl/dist/softcore/softcore.bat vendor/ficl/dist/softcore/softcore.pl vendor/ficl/dist/softcore/softcore.py vendor/ficl/dist/softcore/softcore.py.bat vendor/ficl/dist/softwords/ vendor/ficl/dist/sysdep.c vendor/ficl/dist/sysdep.h vendor/ficl/dist/testmain.c vendor/ficl/dist/unix.c vendor/ficl/dist/win32.c vendor/ficl/dist/words.c Modified: vendor/ficl/dist/Makefile.linux vendor/ficl/dist/ReadMe.txt vendor/ficl/dist/doc/favicon.ico vendor/ficl/dist/doc/ficl.html vendor/ficl/dist/doc/index.html vendor/ficl/dist/ficl.dsw vendor/ficl/dist/ficl.h vendor/ficl/dist/fileaccess.c vendor/ficl/dist/float.c vendor/ficl/dist/prefix.c vendor/ficl/dist/search.c vendor/ficl/dist/softcore.c vendor/ficl/dist/softcore/classes.fr vendor/ficl/dist/softcore/ficlclass.fr vendor/ficl/dist/softcore/ficllocal.fr vendor/ficl/dist/softcore/fileaccess.fr vendor/ficl/dist/softcore/forml.fr vendor/ficl/dist/softcore/ifbrack.fr vendor/ficl/dist/softcore/jhlocal.fr vendor/ficl/dist/softcore/makefile vendor/ficl/dist/softcore/marker.fr vendor/ficl/dist/softcore/oo.fr vendor/ficl/dist/softcore/prefix.fr vendor/ficl/dist/softcore/softcore.fr vendor/ficl/dist/softcore/string.fr vendor/ficl/dist/softcore/win32.fr vendor/ficl/dist/stack.c vendor/ficl/dist/test/asm68k.4th vendor/ficl/dist/test/core.fr vendor/ficl/dist/test/fib.fr vendor/ficl/dist/test/ficltest.fr vendor/ficl/dist/test/ooptest.fr vendor/ficl/dist/test/prefix.fr vendor/ficl/dist/test/sarray.fr vendor/ficl/dist/test/testcase.fr vendor/ficl/dist/test/tester.fr vendor/ficl/dist/test/vocab.fr vendor/ficl/dist/tools.c vendor/ficl/dist/vm.c Added: vendor/ficl/dist/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,60 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +#TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) -Wall +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +# depend explicitly to help finding source files in another subdirectory, +# and repeat commands since gmake doesn't understand otherwise +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* ficl Added: vendor/ficl/dist/Makefile.ansi ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/Makefile.ansi Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o ansi.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/ansi.h +# +# Flags for shared library +TARGET= -ansi -DFICL_ANSI # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/ansi.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Modified: vendor/ficl/dist/Makefile.linux ============================================================================== --- vendor/ficl/dist/Makefile.linux Tue May 12 02:38:48 2015 (r282802) +++ vendor/ficl/dist/Makefile.linux Tue May 12 03:27:06 2015 (r282803) @@ -1,19 +1,20 @@ -OBJECTS= dict.o ficl.o fileaccess.o float.o math64.o prefix.o search.o softcore.o stack.o sysdep.o tools.o unix.o vm.o words.o -HEADERS= ficl.h math64.h sysdep.h +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h # # Flags for shared library TARGET= -Dlinux # riscos MOTO_CPU32 SHFLAGS = -fPIC -CFLAGS= -O -c $(SHFLAGS) $(TARGET) -CC=gcc +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc LIB = ar cr RANLIB = ranlib -MAJOR = 3 -MINOR = 0.1 +MAJOR = 4 +MINOR = 1.0 -ficl: testmain.o ficl.h sysdep.h libficl.a - $(CC) testmain.o -o ficl -L. -lficl -lm +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm lib: libficl.so.$(MAJOR).$(MINOR) @@ -28,23 +29,26 @@ libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so -testmain: testmain.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) - $(CC) testmain.o -o testmain -L. -lficl -lm +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/unix.c + # # generic object code # .SUFFIXES: .cxx .cc .c .o .c.o: - $(CC) $(CFLAGS) -c $*.c + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< .cxx.o: - $(CPP) $(CPFLAGS) -c $*.cxx + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< .cc.o: - $(CPP) $(CPFLAGS) -c $*.cc + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< # # generic cleanup code # Modified: vendor/ficl/dist/ReadMe.txt ============================================================================== --- vendor/ficl/dist/ReadMe.txt Tue May 12 02:38:48 2015 (r282802) +++ vendor/ficl/dist/ReadMe.txt Tue May 12 03:27:06 2015 (r282803) @@ -1,5 +1,5 @@ -FICL 3.03 -April 2002 +FICL 4.1.0 +October 2010 ________ OVERVIEW @@ -10,18 +10,22 @@ and development prototype language. Fic Command Language". For more information, please see the "doc" directory. -For release notes, please see "doc/ficl_rel.html". +For release notes, please see "doc/releases.html". ____________ INSTALLATION Ficl builds out-of-the-box on the following platforms: - * Linux: use "Makefile.linux". - * RiscOS: use "Makefile.riscos". + * NetBSD, FreeBSD: use "Makefile". + * Linux: use "Makefile.linux", but it should work with + "Makefile" as well. * Win32: use "ficl.dsw" / "ficl.dsp". -To port to other platforms, be sure to examine "sysdep.h", and -we suggest you start with the Linux makefile. (And please--feel -free to submit your portability changes!) +To port to other platforms, we suggest you start with the generic +"Makefile" and the "unix.c" / "unix.h" platform-specific implementation +files. (And please--feel free to submit your portability changes!) + +(Note: Ficl used to build under RiscOS, but we broke everything +for the 4.0 release. Please fix it and send us the diffs!) ____________ FICL LICENSE Added: vendor/ficl/dist/bit.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/bit.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,49 @@ +#include "ficl.h" + +int ficlBitGet(const unsigned char *bits, size_t index) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + return ((mask & bits[byteIndex]) ? 1 : 0); + } + + + +void ficlBitSet(unsigned char *bits, size_t index, int value) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + if (value) + bits[byteIndex] |= mask; + else + bits[byteIndex] &= ~mask; + } + + +void ficlBitGetString(unsigned char *destination, const unsigned char *source, int offset, int count, int destAlignment) + { + int bit = destAlignment - count; + while (count--) + ficlBitSet(destination, bit++, ficlBitGet(source, offset++)); + } + + +/* +** This will actually work correctly *regardless* of the local architecture. +** --lch +**/ +ficlUnsigned16 ficlNetworkUnsigned16(ficlUnsigned16 number) +{ + ficlUnsigned8 *pointer = (ficlUnsigned8 *)&number; + return (ficlUnsigned16)(((ficlUnsigned16)(pointer[0] << 8)) | (pointer[1])); +} + +ficlUnsigned32 ficlNetworkUnsigned32(ficlUnsigned32 number) +{ + ficlUnsigned16 *pointer = (ficlUnsigned16 *)&number; + return ((ficlUnsigned32)(ficlNetworkUnsigned16(pointer[0]) << 16)) | ficlNetworkUnsigned16(pointer[1]); +} Added: vendor/ficl/dist/callback.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/callback.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,76 @@ +#include "ficl.h" + + +extern ficlSystem *ficlSystemGlobal; + +/************************************************************************** + f i c l C a l l b a c k T e x t O u t +** Feeds text to the vm's output callback +**************************************************************************/ +void ficlCallbackTextOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction textOut = NULL; + + if (callback != NULL) + { + if (callback->textOut != NULL) + textOut = callback->textOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackTextOut(&(callback->system->callback), text); + return; + } + } + + if ((textOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + textOut = callback->textOut; + } + + if (textOut == NULL) + textOut = ficlCallbackDefaultTextOut; + + (textOut)(callback, text); + + return; +} + + +/************************************************************************** + f i c l C a l l b a c k E r r o r O u t +** Feeds text to the vm's error output callback +**************************************************************************/ +void ficlCallbackErrorOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction errorOut = NULL; + + if (callback != NULL) + { + if (callback->errorOut != NULL) + errorOut = callback->errorOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackErrorOut(&(callback->system->callback), text); + return; + } + } + + if ((errorOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + errorOut = callback->errorOut; + } + + if (errorOut == NULL) + { + ficlCallbackTextOut(callback, text); + return; + } + + (errorOut)(callback, text); + + return; +} + + Added: vendor/ficl/dist/compatibility.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/compatibility.c Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,284 @@ +#define FICL_FORCE_COMPATIBILITY 1 +#include "ficl.h" + + +FICL_PLATFORM_EXTERN ficlStack *stackCreate (unsigned cells) { return ficlStackCreate(NULL, "unknown", cells); } +FICL_PLATFORM_EXTERN void stackDelete (ficlStack *stack) { ficlStackDestroy(stack); } +FICL_PLATFORM_EXTERN int stackDepth (ficlStack *stack) { return ficlStackDepth(stack); } +FICL_PLATFORM_EXTERN void stackDrop (ficlStack *stack, int n) { ficlStackDrop(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackFetch (ficlStack *stack, int n) { return ficlStackFetch(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackGetTop (ficlStack *stack) { return ficlStackFetch(stack, 0); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN void stackLink (ficlStack *stack, int cells) { ficlStackLink(stack, cells); } +FICL_PLATFORM_EXTERN void stackUnlink (ficlStack *stack) { ficlStackUnlink(stack); } +#endif /* FICL_WANT_LOCALS */ +FICL_PLATFORM_EXTERN void stackPick (ficlStack *stack, int n) { ficlStackPick(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackPop (ficlStack *stack) { return ficlStackPop(stack); } +FICL_PLATFORM_EXTERN void *stackPopPtr (ficlStack *stack) { return ficlStackPopPointer(stack); } +FICL_PLATFORM_EXTERN ficlUnsigned stackPopUNS (ficlStack *stack) { return ficlStackPopUnsigned(stack); } +FICL_PLATFORM_EXTERN ficlInteger stackPopINT (ficlStack *stack) { return ficlStackPopInteger(stack); } +FICL_PLATFORM_EXTERN void stackPush (ficlStack *stack, ficlCell cell) { ficlStackPush(stack, cell); } +FICL_PLATFORM_EXTERN void stackPushPtr (ficlStack *stack, void *pointer) { ficlStackPushPointer(stack, pointer); } +FICL_PLATFORM_EXTERN void stackPushUNS (ficlStack *stack, ficlUnsigned u) { ficlStackPushUnsigned(stack, u); } +FICL_PLATFORM_EXTERN void stackPushINT (ficlStack *stack, ficlInteger i) { ficlStackPushInteger(stack, i); } +FICL_PLATFORM_EXTERN void stackReset (ficlStack *stack) { ficlStackReset(stack); } +FICL_PLATFORM_EXTERN void stackRoll (ficlStack *stack, int n) { ficlStackRoll(stack, n); } +FICL_PLATFORM_EXTERN void stackSetTop (ficlStack *stack, ficlCell cell) { ficlStackSetTop(stack, cell); } +FICL_PLATFORM_EXTERN void stackStore (ficlStack *stack, int n, ficlCell cell) { ficlStackStore(stack, n, cell); } + +#if (FICL_WANT_FLOAT) +FICL_PLATFORM_EXTERN ficlFloat stackPopFloat (ficlStack *stack) { return ficlStackPopFloat(stack); } +FICL_PLATFORM_EXTERN void stackPushFloat(ficlStack *stack, ficlFloat f) { ficlStackPushFloat(stack, f); } +#endif + +FICL_PLATFORM_EXTERN int wordIsImmediate(ficlWord *word) { return ficlWordIsImmediate(word); } +FICL_PLATFORM_EXTERN int wordIsCompileOnly(ficlWord *word) { return ficlWordIsCompileOnly(word); } + + +FICL_PLATFORM_EXTERN void vmBranchRelative(ficlVm *vm, int offset) { ficlVmBranchRelative(vm, offset); } +FICL_PLATFORM_EXTERN ficlVm *vmCreate (ficlVm *vm, unsigned nPStack, unsigned nRStack) { return ficlVmCreate(vm, nPStack, nRStack); } +FICL_PLATFORM_EXTERN void vmDelete (ficlVm *vm) { ficlVmDestroy(vm); } +FICL_PLATFORM_EXTERN void vmExecute (ficlVm *vm, ficlWord *word) { ficlVmExecuteWord(vm, word); } +FICL_PLATFORM_EXTERN ficlDictionary *vmGetDict (ficlVm *vm) { return ficlVmGetDictionary(vm); } +FICL_PLATFORM_EXTERN char * vmGetString (ficlVm *vm, ficlCountedString *spDest, char delimiter) { return ficlVmGetString(vm, spDest, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmGetWord (ficlVm *vm) { return ficlVmGetWord(vm); } +FICL_PLATFORM_EXTERN ficlString vmGetWord0 (ficlVm *vm) { return ficlVmGetWord0(vm); } +FICL_PLATFORM_EXTERN int vmGetWordToPad (ficlVm *vm) { return ficlVmGetWordToPad(vm); } +FICL_PLATFORM_EXTERN ficlString vmParseString (ficlVm *vm, char delimiter) { return ficlVmParseString(vm, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmParseStringEx(ficlVm *vm, char delimiter, char skipLeading) { return ficlVmParseStringEx(vm, delimiter, skipLeading); } +FICL_PLATFORM_EXTERN ficlCell vmPop (ficlVm *vm) { return ficlVmPop(vm); } +FICL_PLATFORM_EXTERN void vmPush (ficlVm *vm, ficlCell cell) { ficlVmPush(vm, cell); } +FICL_PLATFORM_EXTERN void vmPopIP (ficlVm *vm) { ficlVmPopIP(vm); } +FICL_PLATFORM_EXTERN void vmPushIP (ficlVm *vm, ficlIp newIP) { ficlVmPushIP(vm, newIP); } +FICL_PLATFORM_EXTERN void vmQuit (ficlVm *vm) { ficlVmQuit(vm); } +FICL_PLATFORM_EXTERN void vmReset (ficlVm *vm) { ficlVmReset(vm); } +FICL_PLATFORM_EXTERN void vmThrow (ficlVm *vm, int except) { ficlVmThrow(vm, except); } +FICL_PLATFORM_EXTERN void vmThrowErr (ficlVm *vm, char *fmt, ...) { va_list list; va_start(list, fmt); ficlVmThrowErrorVararg(vm, fmt, list); va_end(list); } + +FICL_PLATFORM_EXTERN void vmCheckStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->dataStack, popCells, pushCells); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void vmCheckFStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->floatStack, popCells, pushCells); } +#endif + +FICL_PLATFORM_EXTERN void vmPushTib (ficlVm *vm, char *text, ficlInteger nChars, ficlTIB *pSaveTib) { ficlVmPushTib(vm, text, nChars, pSaveTib); } +FICL_PLATFORM_EXTERN void vmPopTib (ficlVm *vm, ficlTIB *pTib) { ficlVmPopTib(vm, pTib); } + +FICL_PLATFORM_EXTERN int isPowerOfTwo(ficlUnsigned u) { return ficlIsPowerOfTwo(u); } + +#if defined(_WIN32) +/* #SHEESH +** Why do Microsoft Meatballs insist on contaminating +** my namespace with their string functions??? +*/ +#pragma warning(disable: 4273) +#endif +char *ltoa(ficlInteger value, char *string, int radix ) { return ficlLtoa(value, string, radix); } +char *ultoa(ficlUnsigned value, char *string, int radix ) { return ficlUltoa(value, string, radix); } +char *strrev( char *string ) { return ficlStringReverse(string); } +#if defined(_WIN32) +#pragma warning(default: 4273) +#endif +FICL_PLATFORM_EXTERN char digit_to_char(int value) { return ficlDigitToCharacter(value); } +FICL_PLATFORM_EXTERN char *skipSpace(char *cp, char *end) { return ficlStringSkipSpace(cp, end); } +FICL_PLATFORM_EXTERN char *caseFold(char *cp) { return ficlStringCaseFold(cp); } +FICL_PLATFORM_EXTERN int strincmp(char *cp1, char *cp2, ficlUnsigned count) { return ficlStrincmp(cp1, cp2, count); } + +FICL_PLATFORM_EXTERN void hashForget (ficlHash *hash, void *where) { ficlHashForget(hash, where); } +FICL_PLATFORM_EXTERN ficlUnsigned16 hashHashCode (ficlString string) { return ficlHashCode(string); } +FICL_PLATFORM_EXTERN void hashInsertWord(ficlHash *hash, ficlWord *word) { ficlHashInsertWord(hash, word); } +FICL_PLATFORM_EXTERN ficlWord *hashLookup (ficlHash *hash, ficlString string, ficlUnsigned16 hashCode) { return ficlHashLookup(hash, string, hashCode); } +FICL_PLATFORM_EXTERN void hashReset (ficlHash *hash) { ficlHashReset(hash); } + + +FICL_PLATFORM_EXTERN void *alignPtr(void *ptr) { return ficlAlignPointer(ptr); } +FICL_PLATFORM_EXTERN void dictAbortDefinition(ficlDictionary *dictionary) { ficlDictionaryAbortDefinition(dictionary); } +FICL_PLATFORM_EXTERN void dictAlign (ficlDictionary *dictionary) { ficlDictionaryAlign(dictionary); } +FICL_PLATFORM_EXTERN int dictAllot (ficlDictionary *dictionary, int n) { ficlDictionaryAllot(dictionary, n); return 0; } +FICL_PLATFORM_EXTERN int dictAllotCells (ficlDictionary *dictionary, int cells) { ficlDictionaryAllotCells(dictionary, cells); return 0; } +FICL_PLATFORM_EXTERN void dictAppendCell (ficlDictionary *dictionary, ficlCell cell) { ficlDictionaryAppendCell(dictionary, cell); } +FICL_PLATFORM_EXTERN void dictAppendChar (ficlDictionary *dictionary, char c) { ficlDictionaryAppendCharacter(dictionary, c); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord (ficlDictionary *dictionary, + char *name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendPrimitive(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord2(ficlDictionary *dictionary, + ficlString name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendWord(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN void dictAppendUNS (ficlDictionary *dictionary, ficlUnsigned u) { ficlDictionaryAppendUnsigned(dictionary, u); } +FICL_PLATFORM_EXTERN int dictCellsAvail (ficlDictionary *dictionary) { return ficlDictionaryCellsAvailable(dictionary); } +FICL_PLATFORM_EXTERN int dictCellsUsed (ficlDictionary *dictionary) { return ficlDictionaryCellsUsed(dictionary); } +FICL_PLATFORM_EXTERN void dictCheck (ficlDictionary *dictionary, ficlVm *vm, int n) { FICL_IGNORE(dictionary); FICL_IGNORE(vm); FICL_IGNORE(n); FICL_VM_DICTIONARY_CHECK(vm, dictionary, n); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreate(unsigned cells) { return ficlDictionaryCreate(NULL, cells); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreateHashed(unsigned cells, unsigned hash) { return ficlDictionaryCreateHashed(NULL, cells, hash); } +FICL_PLATFORM_EXTERN ficlHash *dictCreateWordlist(ficlDictionary *dictionary, int nBuckets) { return ficlDictionaryCreateWordlist(dictionary, nBuckets); } +FICL_PLATFORM_EXTERN void dictDelete (ficlDictionary *dictionary) { ficlDictionaryDestroy(dictionary); } +FICL_PLATFORM_EXTERN void dictEmpty (ficlDictionary *dictionary, unsigned nHash) { ficlDictionaryEmpty(dictionary, nHash); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlPrimitiveHashSummary(ficlVm *vm); +FICL_PLATFORM_EXTERN void dictHashSummary(ficlVm *vm) { ficlPrimitiveHashSummary(vm); } +#endif +FICL_PLATFORM_EXTERN int dictIncludes (ficlDictionary *dictionary, void *p) { return ficlDictionaryIncludes(dictionary, p); } +FICL_PLATFORM_EXTERN ficlWord *dictLookup (ficlDictionary *dictionary, ficlString name) { return ficlDictionaryLookup(dictionary, name); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlWord *ficlLookupLoc (ficlSystem *system, ficlString name) { return ficlDictionaryLookup(ficlSystemGetLocals(system), name); } +#endif +FICL_PLATFORM_EXTERN void dictResetSearchOrder(ficlDictionary *dictionary) { ficlDictionaryResetSearchOrder(dictionary); } +FICL_PLATFORM_EXTERN void dictSetFlags (ficlDictionary *dictionary, ficlUnsigned8 set, ficlUnsigned8 clear) { ficlDictionarySetFlags(dictionary, set); ficlDictionaryClearFlags(dictionary, clear); } +FICL_PLATFORM_EXTERN void dictSetImmediate(ficlDictionary *dictionary) { ficlDictionarySetImmediate(dictionary); } +FICL_PLATFORM_EXTERN void dictUnsmudge (ficlDictionary *dictionary) { ficlDictionaryUnsmudge(dictionary); } +FICL_PLATFORM_EXTERN ficlCell *dictWhere (ficlDictionary *dictionary) { return ficlDictionaryWhere(dictionary); } + +FICL_PLATFORM_EXTERN int ficlAddParseStep(ficlSystem *system, ficlWord *word) { return ficlSystemAddParseStep(system, word); } +FICL_PLATFORM_EXTERN void ficlAddPrecompiledParseStep(ficlSystem *system, char *name, ficlParseStep pStep) { ficlSystemAddPrimitiveParseStep(system, name, pStep); } +FICL_PLATFORM_EXTERN void ficlPrimitiveParseStepList(ficlVm *vm); +FICL_PLATFORM_EXTERN void ficlListParseSteps(ficlVm *vm) { ficlPrimitiveParseStepList(vm); } + +FICL_PLATFORM_EXTERN void ficlTermSystem(ficlSystem *system) { ficlSystemDestroy(system); } +FICL_PLATFORM_EXTERN int ficlEvaluate(ficlVm *vm, char *pText) { return ficlVmEvaluate(vm, pText); } +FICL_PLATFORM_EXTERN int ficlExec (ficlVm *vm, char *pText) { ficlString s; FICL_STRING_SET_FROM_CSTRING(s, pText); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecC(ficlVm *vm, char *pText, ficlInteger nChars) { ficlString s; FICL_STRING_SET_POINTER(s, pText); FICL_STRING_SET_LENGTH(s, nChars); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecXT(ficlVm *vm, ficlWord *word) { return ficlVmExecuteXT(vm, word); } +FICL_PLATFORM_EXTERN void ficlFreeVM(ficlVm *vm) { ficlVmDestroy(vm); } + + + + + +static void thunkTextOut(ficlCallback *callback, char *text) + { + ficlCompatibilityOutputFunction outputFunction; + if ((callback->vm != NULL) && (callback->vm->thunkedTextout != NULL)) + outputFunction = callback->system->thunkedTextout; + else if (callback->system->thunkedTextout != NULL) + outputFunction = callback->system->thunkedTextout; + else + { + ficlCallbackDefaultTextOut(callback, text); + return; + } + ficlCompatibilityTextOutCallback(callback, text, outputFunction); + } + + +FICL_PLATFORM_EXTERN void vmSetTextOut(ficlVm *vm, ficlCompatibilityOutputFunction textOut) + { + vm->thunkedTextout = textOut; + ficlVmSetTextOut(vm, thunkTextOut); + } + +FICL_PLATFORM_EXTERN void vmTextOut (ficlVm *vm, char *text, int fNewline) + { + ficlVmTextOut(vm, text); + if (fNewline) + ficlVmTextOut(vm, "\n"); + } + + +FICL_PLATFORM_EXTERN void ficlTextOut (ficlVm *vm, char *text, int fNewline) + { + vmTextOut(vm, text, fNewline); + } + +extern ficlSystem *ficlSystemGlobal; +static defaultStackSize = FICL_DEFAULT_STACK_SIZE; +FICL_PLATFORM_EXTERN int ficlSetStackSize(int nStackCells) +{ + if (defaultStackSize < nStackCells) + defaultStackSize = nStackCells; + if ((ficlSystemGlobal != NULL) && (ficlSystemGlobal->stackSize < nStackCells)) + ficlSystemGlobal->stackSize = nStackCells; + return defaultStackSize; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystemEx(ficlSystemInformation *fsi) +{ + ficlSystem *returnValue; + ficlCompatibilityOutputFunction thunkedTextout; + ficlSystemInformation clone; + + memcpy(&clone, fsi, sizeof(clone)); + thunkedTextout = (ficlCompatibilityOutputFunction)clone.textOut; + clone.textOut = clone.errorOut = thunkTextOut; + + returnValue = ficlSystemCreate(&clone); + if (returnValue != NULL) + { + returnValue->thunkedTextout = thunkedTextout; + } + return returnValue; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystem(int nDictCells) +{ + ficlSystemInformation fsi; + ficlSystemInformationInitialize(&fsi); + fsi.dictionarySize = nDictCells; + if (fsi.stackSize < defaultStackSize) + fsi.stackSize = defaultStackSize; + return ficlSystemCreate(&fsi); +} + + + + +FICL_PLATFORM_EXTERN ficlVm *ficlNewVM(ficlSystem *system) +{ + ficlVm *returnValue = ficlSystemCreateVm(system); + if (returnValue != NULL) + { + if ((returnValue->callback.textOut != NULL) && (returnValue->callback.textOut != thunkTextOut)) + { + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.textOut; + returnValue->callback.textOut = thunkTextOut; + } + if ((returnValue->callback.errorOut != NULL) && (returnValue->callback.errorOut != thunkTextOut)) + { + if (returnValue->thunkedTextout == NULL) + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.errorOut; + returnValue->callback.errorOut = thunkTextOut; + } + } + return returnValue; +} + + + +FICL_PLATFORM_EXTERN ficlWord *ficlLookup(ficlSystem *system, char *name) { return ficlSystemLookup(system, name); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetDict(ficlSystem *system) { return ficlSystemGetDictionary(system); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetEnv (ficlSystem *system) { return ficlSystemGetEnvironment(system); } +FICL_PLATFORM_EXTERN void ficlSetEnv (ficlSystem *system, char *name, ficlInteger value) { ficlDictionarySetConstant(ficlSystemGetDictionary(system), name, value); } +FICL_PLATFORM_EXTERN void ficlSetEnvD(ficlSystem *system, char *name, ficlInteger high, ficlInteger low) { ficl2Unsigned value; FICL_2UNSIGNED_SET(low, high, value); ficlDictionarySet2Constant(ficlSystemGetDictionary(system), name, FICL_2UNSIGNED_TO_2INTEGER(value)); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetLoc (ficlSystem *system) { return ficlSystemGetLocals(system); } +#endif +FICL_PLATFORM_EXTERN int ficlBuild(ficlSystem *system, char *name, ficlPrimitive code, char flags) { ficlDictionary *dictionary = ficlSystemGetDictionary(system); ficlDictionaryLock(dictionary, FICL_TRUE); ficlDictionaryAppendPrimitive(dictionary, name, code, flags); ficlDictionaryLock(dictionary, FICL_FALSE); return 0; } +FICL_PLATFORM_EXTERN void ficlCompileCore(ficlSystem *system) { ficlSystemCompileCore(system); } +FICL_PLATFORM_EXTERN void ficlCompilePrefix(ficlSystem *system) { ficlSystemCompilePrefix(system); } +FICL_PLATFORM_EXTERN void ficlCompileSearch(ficlSystem *system) { ficlSystemCompileSearch(system); } +FICL_PLATFORM_EXTERN void ficlCompileSoftCore(ficlSystem *system) { ficlSystemCompileSoftCore(system); } +FICL_PLATFORM_EXTERN void ficlCompileTools(ficlSystem *system) { ficlSystemCompileTools(system); } +FICL_PLATFORM_EXTERN void ficlCompileFile(ficlSystem *system) { ficlSystemCompileFile(system); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlCompileFloat(ficlSystem *system) { ficlSystemCompileFloat(system); } +FICL_PLATFORM_EXTERN int ficlParseFloatNumber( ficlVm *vm, ficlString string) { return ficlVmParseFloatNumber(vm, string); } +#endif +#if FICL_WANT_PLATFORM +FICL_PLATFORM_EXTERN void ficlCompilePlatform(ficlSystem *system) { ficlSystemCompilePlatform(system); } +#endif +FICL_PLATFORM_EXTERN int ficlParsePrefix(ficlVm *vm, ficlString string) { return ficlVmParsePrefix(vm, string); } + +FICL_PLATFORM_EXTERN int ficlParseNumber(ficlVm *vm, ficlString string) { return ficlVmParseNumber(vm, string); } +FICL_PLATFORM_EXTERN void ficlTick(ficlVm *vm) { ficlPrimitiveTick(vm); } +FICL_PLATFORM_EXTERN void parseStepParen(ficlVm *vm) { ficlPrimitiveParseStepParen(vm); } + +FICL_PLATFORM_EXTERN int isAFiclWord(ficlDictionary *dictionary, ficlWord *word) { return ficlDictionaryIsAWord(dictionary, word); } + + +FICL_PLATFORM_EXTERN void buildTestInterface(ficlSystem *system) { ficlSystemCompileExtras(system); } + + Added: vendor/ficl/dist/contrib/xclasses/readme.txt ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/readme.txt Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,111 @@ +XClasses is a simple IDL written in Python. +You declare your classes, methods, and members as Python objects, +and XClasses will generate the .c, .h, and .f files for you. +Not only do the Forth classes line up with their C counterparts +exactly, but all non-static methods (virtual and non-virtual) +are *automatically* thunked. In other words, any method +declared in XClasses and implemented in C can be called from +the matching Ficl class, and the C method will be automatically +called with the correct arguments. XClasses handles floating-point +arguments too! + +Known limitations: + * All arguments must be one cell wide. (That means + only single-precision floats, too.) + + + +To use: + * Declare all your classes in a .py script + * Include "xclasses.h" everywhere you need your classes + * Include xclasses.cpp in your project somewhere + * Call + "xclasses.f" included + from your Ficl initialization script + +And you're mostly done! + +Simply including xclasses.f is not enough, though. You must +explicitly instantiate your classes. This is to allow you a +chance to add your own methods to the class. For a class +named "myCallback", it would look like this: + + declare-myCallback + end-myCallback + +You also have to define the "init" function for the class. +Most of the time this will work fine: + + declare-myCallback + use-default-init + end-myCallback + + +The "default" init function calls the super class's init +function, then sets all data members to 0. If this isn't +what you want, roll your own. The init function takes +the usual 2-cell "this" pointer as its argument: + + declare-myCallback + : init ( 2:this ) ... + ; + end-myCallback + +For a do-nothing init function, you'll want this: + + declare-myCallback + : init 2drop ; + end-myCallback + + +Here's a random example from the simple game I'm working on: + +----------------------------------------------------------------- +skinStream = xMethod("stream", "void").setVirtual(1) +gjeSkin.addMethod(skinStream) + +## +## gjeTexture +## +## +gjeTexture = xClass("gjeTexture") +gjeTexture.setParent(gjeSkin) +gjeTexture.addMethod(skinStream) +gjeTexture.addMethod(xMethod("clear", "void")) +gjeTexture.addMember(xVariable("texture", "LPDIRECT3DTEXTURE8")) +gjeTexture.addMember(xVariable("name", "char *")) +gjeTexture.addMember(xVariable("variation", "int")) +gjeTexture.addMember(xVariable("material", "D3DMATERIAL8 *")) + +----------------------------------------------------------------- + +I sure hope that's enough to get you started. + + + +Random notes: +* XClasses doesn't deal well with struct-packing issues. It assumes + pretty much everything will be 4-byte aligned. This can bite you + if you add a 64-bit int... the C compiler may align it for you, + and XClasses won't know about it. (This could be fixed in a future + release... are you volunteering?) For now, it's best to declare + your classes such that 64-bit ints are naturally 8-byte aligned. + +* If you don't want to have to declare each class in turn, + you can add something like this to the end of your Python script: +----- +def declare(name): + xAddFiclFooter("\t\"" + name + ".constant\" \" sfind swap drop 0= [if] declare-" + name + " use-default-init end-" + name + " [endif] \" evaluate") + + +xAddFiclFooter(": xclassesDeclare") +for c in classes: + declare(c.name) +xAddFiclFooter("\t;") +----- + and then call "xclassesDeclare" from your Ficl script just after + including "xclasses.f". + + +--lch +larry@hastings.org Added: vendor/ficl/dist/contrib/xclasses/xclasses.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/dist/contrib/xclasses/xclasses.py Tue May 12 03:27:06 2015 (r282803) @@ -0,0 +1,870 @@ +import copy +import string +import sys +import time +import types + + +def capitalize(s): + return string.upper(s[0]) + s[1:] + +def fprint(f, s): + print >> f, s + + +def fprintHeader(f, comment = "//"): + fprint(f, comment) + fprint(f, comment + " Generated by xclasses.py at " + time.strftime("%Y/%m/%d %H:%M:%S")) + fprint(f, comment) + fprint(f, comment) + fprint(f, "") + +def fprintFooter(f, comment = "//"): + fprint(f, "") + fprint(f, "") + fprint(f, comment + " end of file") + fprint(f, "") + +multicallCallTypeFunction = 0 +multicallCallTypeMethod = 1 +multicallCallTypeVirtualMethod = 2 + +multicallReturnTypeVoid = 0 +multicallReturnTypeInteger = 16 +multicallReturnTypeCstring = 32 +multicallReturnTypeFloat = 48 + +multicallExplicitVtable = 512 + + +ficlVmName = "ficlVm" + +h_headers = [] +def xAddHHeader(line): + h_headers.append(line) + +h_footers = [] +def xAddHFooter(line): + h_footers.append(line) + +ficl_headers = [] +def xAddFiclHeader(line): + ficl_headers.append(line) + +ficl_footers = [] +def xAddFiclFooter(line): + ficl_footers.append(line) + +c_headers = [] +def xAddCHeader(line): + c_headers.append(line) + +c_footers = [] +def xAddCFooter(line): + c_footers.append(line) + + +classes = [] + +class xVariable: + def __init__(self, name, typeCPP = None, cells = None, count = None, defaultValue = None, cstring = None): + self.comments = [] + self.setName(name) + self.setCells(cells) + self.setCount(count) + self.setDefaultValue(defaultValue) + self.setCString(cstring) + self.setTypeCPP(typeCPP) + + def setName(self, name): + self.name = name + return self + + def setTypeCPP(self, typeCPP): + self.typeCPP = typeCPP + if (typeCPP == "char *"): + self.setCString(1) + return self + + def setCells(self, cells): + if cells == None: + self.cells = 1 + else: + self.cells = cells + return self + + def setCString(self, cstring): + self.cstring = cstring + return self + + def isCString(self): + return self.cstring + + def getTotalSize(self): + return self.cells * self.count + + def setCount(self, count): + if type(count) != types.IntType: + count = 1 + self.count = count + return self + + def setDefaultValue(self, defaultValue): + if (defaultValue != None) and (type(defaultValue) != types.StringType): + defaultValue = str(defaultValue) + self.defaultValue = defaultValue + return self + + def addComment(self, c): + self.comments.append(c) + return self + + def isFloat(self): + return self.typeCPP == "float" + + def stringCPP(self, wantDefaultValues=1): + if (type(self.typeCPP) != types.StringType): + sys.exit("didn't set a CPP type on variable " + self.name + "!") + output = self.typeCPP + if (self.typeCPP[-1] != "*") and (self.typeCPP[-1] != "&"): + output += " " + output += self.name + if self.count > 1: + output += "[" + str(self.count) + "]" + if self.count == 0: + output += "[]" + if wantDefaultValues and (self.defaultValue != None): + output += " = " + self.defaultValue + return output + + def printH(self, f): + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + self.stringCPP() + ";") + + def printF(self, f): + totalCells = self.count * self.cells + if (totalCells <= 1): + typeF = "cell:" + else: + typeF = str(totalCells) + " cells:" + if len(self.comments): + for comment in self.comments: + fprint(f, "\t" + "// " + comment) + fprint(f, "\t" + "S\" " + typeF + " ." + self.name + " \" evaluate") + + +class xMethod: + def __init__(self, name, returnType = None, virtual = None, static = None, body = None): + self.arguments = [] + self.comments = [] + + self.setName(name) + self.setReturnType(returnType) + self.setVirtual(virtual) + self.setStatic(static) + self.setBody(body) + self.setThunkVariable(None) + self.vtableOffset = 0 + + def copy(): + clone = xMethod(self.name, self.returnType, self.virtual, self.static) + clone.arguments = self.arguments + clone.comments = self.comments + + def setName(self, name): + self.name = name + return self + + def setReturnType(self, returnType): + if returnType.__class__ == xVariable: + self.returnType = returnType + elif type(returnType) == types.StringType: + self.returnType = xVariable("ignored", returnType) + else: + self.returnType = None + return self + + def returnTypeIsVoid(self): + return(self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") or (self.returnType.typeCPP == "void") + + def setVirtual(self, virtual): + self.virtual = virtual + return self + + def isVirtual(self): + return self.virtual > 0 + + def isPureVirtual(self): + return self.virtual > 1 + + def setStatic(self, static): + self.static = static + return self + + def setThunkVariable(self, thunkVariable): + self.thunkVariable = thunkVariable + return self + + def isStatic(self): + return self.static + + # a constructor or a destructor + def isClassSpecial(self): + return (self.returnType == None) or (self.returnType.typeCPP == None) or (self.returnType.typeCPP == "") + + def setBody(self, body): + self.body = body + return self + + def addArgument(self, argument): + self.arguments.append(argument) + return self + + def addComment(self, c): + self.comments.append(c) + return self + + def prototype(self, isDefinition=None): + arguments = "" + for a in self.arguments: + if len(arguments): + arguments += ", " + arguments += a.stringCPP(not isDefinition) + + if len(arguments) == 0: + arguments = "void" + className = "" + if (isDefinition): + className = self.memberOf.name + "::" + modifiers = "" *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Tue May 12 03:29:53 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id F08537D2; Tue, 12 May 2015 03:29:52 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB0E11691; Tue, 12 May 2015 03:29:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4C3Tqu4071887; Tue, 12 May 2015 03:29:52 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4C3Topf071873; Tue, 12 May 2015 03:29:50 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201505120329.t4C3Topf071873@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 12 May 2015 03:29:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282804 - in vendor/ficl/4.1.0: . contrib doc doc/articles doc/graphics doc/source ficlplatform softcore softwords test X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 May 2015 03:29:53 -0000 Author: pfg Date: Tue May 12 03:29:50 2015 New Revision: 282804 URL: https://svnweb.freebsd.org/changeset/base/282804 Log: Tag ficl 4.1.0 Added: vendor/ficl/4.1.0/ - copied from r282801, vendor/ficl/dist/ vendor/ficl/4.1.0/Makefile - copied unchanged from r282803, vendor/ficl/dist/Makefile vendor/ficl/4.1.0/Makefile.ansi - copied unchanged from r282803, vendor/ficl/dist/Makefile.ansi vendor/ficl/4.1.0/bit.c - copied unchanged from r282803, vendor/ficl/dist/bit.c vendor/ficl/4.1.0/callback.c - copied unchanged from r282803, vendor/ficl/dist/callback.c vendor/ficl/4.1.0/compatibility.c - copied unchanged from r282803, vendor/ficl/dist/compatibility.c vendor/ficl/4.1.0/contrib/ - copied from r282803, vendor/ficl/dist/contrib/ vendor/ficl/4.1.0/dictionary.c - copied unchanged from r282803, vendor/ficl/dist/dictionary.c vendor/ficl/4.1.0/doc/api.html - copied unchanged from r282803, vendor/ficl/dist/doc/api.html vendor/ficl/4.1.0/doc/articles/ - copied from r282803, vendor/ficl/dist/doc/articles/ vendor/ficl/4.1.0/doc/debugger.html - copied unchanged from r282803, vendor/ficl/dist/doc/debugger.html vendor/ficl/4.1.0/doc/dpans.html - copied unchanged from r282803, vendor/ficl/dist/doc/dpans.html vendor/ficl/4.1.0/doc/graphics/ - copied from r282803, vendor/ficl/dist/doc/graphics/ vendor/ficl/4.1.0/doc/license.html - copied unchanged from r282803, vendor/ficl/dist/doc/license.html vendor/ficl/4.1.0/doc/links.html - copied unchanged from r282803, vendor/ficl/dist/doc/links.html vendor/ficl/4.1.0/doc/locals.html - copied unchanged from r282803, vendor/ficl/dist/doc/locals.html vendor/ficl/4.1.0/doc/oop.html - copied unchanged from r282803, vendor/ficl/dist/doc/oop.html vendor/ficl/4.1.0/doc/parsesteps.html - copied unchanged from r282803, vendor/ficl/dist/doc/parsesteps.html vendor/ficl/4.1.0/doc/releases.html - copied unchanged from r282803, vendor/ficl/dist/doc/releases.html vendor/ficl/4.1.0/doc/source/ - copied from r282803, vendor/ficl/dist/doc/source/ vendor/ficl/4.1.0/doc/upgrading.html - copied unchanged from r282803, vendor/ficl/dist/doc/upgrading.html vendor/ficl/4.1.0/double.c - copied unchanged from r282803, vendor/ficl/dist/double.c vendor/ficl/4.1.0/extras.c - copied unchanged from r282803, vendor/ficl/dist/extras.c vendor/ficl/4.1.0/ficlcompatibility.h - copied unchanged from r282803, vendor/ficl/dist/ficlcompatibility.h vendor/ficl/4.1.0/ficldll.def - copied unchanged from r282803, vendor/ficl/dist/ficldll.def vendor/ficl/4.1.0/ficldll.dsp - copied unchanged from r282803, vendor/ficl/dist/ficldll.dsp vendor/ficl/4.1.0/ficlexe.dsp - copied unchanged from r282803, vendor/ficl/dist/ficlexe.dsp vendor/ficl/4.1.0/ficllib.dsp - copied unchanged from r282803, vendor/ficl/dist/ficllib.dsp vendor/ficl/4.1.0/ficllocal.h - copied unchanged from r282803, vendor/ficl/dist/ficllocal.h vendor/ficl/4.1.0/ficlplatform/ - copied from r282803, vendor/ficl/dist/ficlplatform/ vendor/ficl/4.1.0/ficltokens.h - copied unchanged from r282803, vendor/ficl/dist/ficltokens.h vendor/ficl/4.1.0/hash.c - copied unchanged from r282803, vendor/ficl/dist/hash.c vendor/ficl/4.1.0/lzcompress.c - copied unchanged from r282803, vendor/ficl/dist/lzcompress.c vendor/ficl/4.1.0/lzuncompress.c - copied unchanged from r282803, vendor/ficl/dist/lzuncompress.c vendor/ficl/4.1.0/main.c - copied unchanged from r282803, vendor/ficl/dist/main.c vendor/ficl/4.1.0/primitives.c - copied unchanged from r282803, vendor/ficl/dist/primitives.c vendor/ficl/4.1.0/softcore/ - copied from r282803, vendor/ficl/dist/softcore/ vendor/ficl/4.1.0/system.c - copied unchanged from r282803, vendor/ficl/dist/system.c vendor/ficl/4.1.0/utility.c - copied unchanged from r282803, vendor/ficl/dist/utility.c vendor/ficl/4.1.0/word.c - copied unchanged from r282803, vendor/ficl/dist/word.c Replaced: vendor/ficl/4.1.0/Makefile.linux - copied unchanged from r282803, vendor/ficl/dist/Makefile.linux vendor/ficl/4.1.0/ReadMe.txt - copied unchanged from r282803, vendor/ficl/dist/ReadMe.txt vendor/ficl/4.1.0/doc/favicon.ico - copied unchanged from r282803, vendor/ficl/dist/doc/favicon.ico vendor/ficl/4.1.0/doc/ficl.html - copied unchanged from r282803, vendor/ficl/dist/doc/ficl.html vendor/ficl/4.1.0/doc/index.html - copied unchanged from r282803, vendor/ficl/dist/doc/index.html vendor/ficl/4.1.0/ficl.dsw - copied unchanged from r282803, vendor/ficl/dist/ficl.dsw vendor/ficl/4.1.0/ficl.h - copied unchanged from r282803, vendor/ficl/dist/ficl.h vendor/ficl/4.1.0/fileaccess.c - copied unchanged from r282803, vendor/ficl/dist/fileaccess.c vendor/ficl/4.1.0/float.c - copied unchanged from r282803, vendor/ficl/dist/float.c vendor/ficl/4.1.0/prefix.c - copied unchanged from r282803, vendor/ficl/dist/prefix.c vendor/ficl/4.1.0/search.c - copied unchanged from r282803, vendor/ficl/dist/search.c vendor/ficl/4.1.0/softcore.c - copied unchanged from r282803, vendor/ficl/dist/softcore.c vendor/ficl/4.1.0/stack.c - copied unchanged from r282803, vendor/ficl/dist/stack.c vendor/ficl/4.1.0/test/asm68k.4th - copied unchanged from r282803, vendor/ficl/dist/test/asm68k.4th vendor/ficl/4.1.0/test/core.fr - copied unchanged from r282803, vendor/ficl/dist/test/core.fr vendor/ficl/4.1.0/test/fib.fr - copied unchanged from r282803, vendor/ficl/dist/test/fib.fr vendor/ficl/4.1.0/test/ficltest.fr - copied unchanged from r282803, vendor/ficl/dist/test/ficltest.fr vendor/ficl/4.1.0/test/ooptest.fr - copied unchanged from r282803, vendor/ficl/dist/test/ooptest.fr vendor/ficl/4.1.0/test/prefix.fr - copied unchanged from r282803, vendor/ficl/dist/test/prefix.fr vendor/ficl/4.1.0/test/sarray.fr - copied unchanged from r282803, vendor/ficl/dist/test/sarray.fr vendor/ficl/4.1.0/test/testcase.fr - copied unchanged from r282803, vendor/ficl/dist/test/testcase.fr vendor/ficl/4.1.0/test/tester.fr - copied unchanged from r282803, vendor/ficl/dist/test/tester.fr vendor/ficl/4.1.0/test/vocab.fr - copied unchanged from r282803, vendor/ficl/dist/test/vocab.fr vendor/ficl/4.1.0/tools.c - copied unchanged from r282803, vendor/ficl/dist/tools.c vendor/ficl/4.1.0/vm.c - copied unchanged from r282803, vendor/ficl/dist/vm.c Deleted: vendor/ficl/4.1.0/dict.c vendor/ficl/4.1.0/doc/Logo.jpg vendor/ficl/4.1.0/doc/ficl1.ico vendor/ficl/4.1.0/doc/ficl_debug.html vendor/ficl/4.1.0/doc/ficl_guts.htm vendor/ficl/4.1.0/doc/ficl_loc.html vendor/ficl/4.1.0/doc/ficl_logo.jpg vendor/ficl/4.1.0/doc/ficl_oop.html vendor/ficl/4.1.0/doc/ficl_oop.jpg vendor/ficl/4.1.0/doc/ficl_parse.html vendor/ficl/4.1.0/doc/ficl_rel.html vendor/ficl/4.1.0/doc/ficl_top.jpg vendor/ficl/4.1.0/doc/ficlddj.PDF vendor/ficl/4.1.0/doc/ficlheader.js vendor/ficl/4.1.0/doc/jwsforml.PDF vendor/ficl/4.1.0/doc/oo_in_c.html vendor/ficl/4.1.0/doc/primer.txt vendor/ficl/4.1.0/doc/sigplan9906.doc vendor/ficl/4.1.0/doc/skey.gif vendor/ficl/4.1.0/ficl.c vendor/ficl/4.1.0/ficl.dsp vendor/ficl/4.1.0/math64.c vendor/ficl/4.1.0/math64.h vendor/ficl/4.1.0/softwords/ vendor/ficl/4.1.0/sysdep.c vendor/ficl/4.1.0/sysdep.h vendor/ficl/4.1.0/testmain.c vendor/ficl/4.1.0/unix.c vendor/ficl/4.1.0/win32.c vendor/ficl/4.1.0/words.c Copied: vendor/ficl/4.1.0/Makefile (from r282803, vendor/ficl/dist/Makefile) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/Makefile Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/Makefile) @@ -0,0 +1,60 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +#TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) -Wall +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) $(LDFLAGS) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) $(CFLAGS) $(LDFLAGS) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +# depend explicitly to help finding source files in another subdirectory, +# and repeat commands since gmake doesn't understand otherwise +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* ficl Copied: vendor/ficl/4.1.0/Makefile.ansi (from r282803, vendor/ficl/dist/Makefile.ansi) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/Makefile.ansi Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/Makefile.ansi) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o ansi.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/ansi.h +# +# Flags for shared library +TARGET= -ansi -DFICL_ANSI # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +ansi.o: ficlplatform/ansi.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/ansi.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Copied: vendor/ficl/4.1.0/Makefile.linux (from r282803, vendor/ficl/dist/Makefile.linux) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/Makefile.linux Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/Makefile.linux) @@ -0,0 +1,56 @@ +OBJECTS= dictionary.o system.o fileaccess.o float.o double.o prefix.o search.o softcore.o stack.o tools.o vm.o primitives.o bit.o lzuncompress.o unix.o utility.o hash.o callback.o word.o extras.o +HEADERS= ficl.h ficlplatform/unix.h +# +# Flags for shared library +TARGET= -Dlinux # riscos MOTO_CPU32 +SHFLAGS = -fPIC +CFLAGS= -O $(SHFLAGS) +CPPFLAGS= $(TARGET) -I. +CC = cc +LIB = ar cr +RANLIB = ranlib + +MAJOR = 4 +MINOR = 1.0 + +ficl: main.o $(HEADERS) libficl.a + $(CC) main.o -o ficl -L. -lficl -lm + +lib: libficl.so.$(MAJOR).$(MINOR) + +# static library build +libficl.a: $(OBJECTS) + $(LIB) libficl.a $(OBJECTS) + $(RANLIB) libficl.a + +# shared library build +libficl.so.$(MAJOR).$(MINOR): $(OBJECTS) + $(CC) -shared -Wl,-soname,libficl.so.$(MAJOR).$(MINOR) \ + -o libficl.so.$(MAJOR).$(MINOR) $(OBJECTS) + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so + +main: main.o ficl.h sysdep.h libficl.so.$(MAJOR).$(MINOR) + $(CC) main.o -o main -L. -lficl -lm + ln -sf libficl.so.$(MAJOR).$(MINOR) libficl.so.$(MAJOR) + +unix.o: ficlplatform/unix.c $(HEADERS) + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ficlplatform/unix.c + +# +# generic object code +# +.SUFFIXES: .cxx .cc .c .o + +.c.o: + $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cxx.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< + +.cc.o: + $(CPP) $(CXXFLAGS) $(CPPFLAGS) -c -o $@ $< +# +# generic cleanup code +# +clean: + rm -f *.o *.a libficl.* Copied: vendor/ficl/4.1.0/ReadMe.txt (from r282803, vendor/ficl/dist/ReadMe.txt) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/ReadMe.txt Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/ReadMe.txt) @@ -0,0 +1,53 @@ +FICL 4.1.0 +October 2010 + +________ +OVERVIEW + +Ficl is a complete programming language interpreter designed to be embedded +into other systems (including firmware based ones) as a command, macro, +and development prototype language. Ficl stands for "Forth Inspired +Command Language". + +For more information, please see the "doc" directory. +For release notes, please see "doc/releases.html". + +____________ +INSTALLATION + +Ficl builds out-of-the-box on the following platforms: + * NetBSD, FreeBSD: use "Makefile". + * Linux: use "Makefile.linux", but it should work with + "Makefile" as well. + * Win32: use "ficl.dsw" / "ficl.dsp". +To port to other platforms, we suggest you start with the generic +"Makefile" and the "unix.c" / "unix.h" platform-specific implementation +files. (And please--feel free to submit your portability changes!) + +(Note: Ficl used to build under RiscOS, but we broke everything +for the 4.0 release. Please fix it and send us the diffs!) + +____________ +FICL LICENSE + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +SUCH DAMAGE. + Copied: vendor/ficl/4.1.0/bit.c (from r282803, vendor/ficl/dist/bit.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/bit.c Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/bit.c) @@ -0,0 +1,49 @@ +#include "ficl.h" + +int ficlBitGet(const unsigned char *bits, size_t index) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + return ((mask & bits[byteIndex]) ? 1 : 0); + } + + + +void ficlBitSet(unsigned char *bits, size_t index, int value) + { + int byteIndex = index >> 3; + int bitIndex = index & 7; + unsigned char mask = (unsigned char)(128 >> bitIndex); + + if (value) + bits[byteIndex] |= mask; + else + bits[byteIndex] &= ~mask; + } + + +void ficlBitGetString(unsigned char *destination, const unsigned char *source, int offset, int count, int destAlignment) + { + int bit = destAlignment - count; + while (count--) + ficlBitSet(destination, bit++, ficlBitGet(source, offset++)); + } + + +/* +** This will actually work correctly *regardless* of the local architecture. +** --lch +**/ +ficlUnsigned16 ficlNetworkUnsigned16(ficlUnsigned16 number) +{ + ficlUnsigned8 *pointer = (ficlUnsigned8 *)&number; + return (ficlUnsigned16)(((ficlUnsigned16)(pointer[0] << 8)) | (pointer[1])); +} + +ficlUnsigned32 ficlNetworkUnsigned32(ficlUnsigned32 number) +{ + ficlUnsigned16 *pointer = (ficlUnsigned16 *)&number; + return ((ficlUnsigned32)(ficlNetworkUnsigned16(pointer[0]) << 16)) | ficlNetworkUnsigned16(pointer[1]); +} Copied: vendor/ficl/4.1.0/callback.c (from r282803, vendor/ficl/dist/callback.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/callback.c Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/callback.c) @@ -0,0 +1,76 @@ +#include "ficl.h" + + +extern ficlSystem *ficlSystemGlobal; + +/************************************************************************** + f i c l C a l l b a c k T e x t O u t +** Feeds text to the vm's output callback +**************************************************************************/ +void ficlCallbackTextOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction textOut = NULL; + + if (callback != NULL) + { + if (callback->textOut != NULL) + textOut = callback->textOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackTextOut(&(callback->system->callback), text); + return; + } + } + + if ((textOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + textOut = callback->textOut; + } + + if (textOut == NULL) + textOut = ficlCallbackDefaultTextOut; + + (textOut)(callback, text); + + return; +} + + +/************************************************************************** + f i c l C a l l b a c k E r r o r O u t +** Feeds text to the vm's error output callback +**************************************************************************/ +void ficlCallbackErrorOut(ficlCallback *callback, char *text) +{ + ficlOutputFunction errorOut = NULL; + + if (callback != NULL) + { + if (callback->errorOut != NULL) + errorOut = callback->errorOut; + else if ((callback->system != NULL) && (callback != &(callback->system->callback))) + { + ficlCallbackErrorOut(&(callback->system->callback), text); + return; + } + } + + if ((errorOut == NULL) && (ficlSystemGlobal != NULL)) + { + callback = &(ficlSystemGlobal->callback); + errorOut = callback->errorOut; + } + + if (errorOut == NULL) + { + ficlCallbackTextOut(callback, text); + return; + } + + (errorOut)(callback, text); + + return; +} + + Copied: vendor/ficl/4.1.0/compatibility.c (from r282803, vendor/ficl/dist/compatibility.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/compatibility.c Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/compatibility.c) @@ -0,0 +1,284 @@ +#define FICL_FORCE_COMPATIBILITY 1 +#include "ficl.h" + + +FICL_PLATFORM_EXTERN ficlStack *stackCreate (unsigned cells) { return ficlStackCreate(NULL, "unknown", cells); } +FICL_PLATFORM_EXTERN void stackDelete (ficlStack *stack) { ficlStackDestroy(stack); } +FICL_PLATFORM_EXTERN int stackDepth (ficlStack *stack) { return ficlStackDepth(stack); } +FICL_PLATFORM_EXTERN void stackDrop (ficlStack *stack, int n) { ficlStackDrop(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackFetch (ficlStack *stack, int n) { return ficlStackFetch(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackGetTop (ficlStack *stack) { return ficlStackFetch(stack, 0); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN void stackLink (ficlStack *stack, int cells) { ficlStackLink(stack, cells); } +FICL_PLATFORM_EXTERN void stackUnlink (ficlStack *stack) { ficlStackUnlink(stack); } +#endif /* FICL_WANT_LOCALS */ +FICL_PLATFORM_EXTERN void stackPick (ficlStack *stack, int n) { ficlStackPick(stack, n); } +FICL_PLATFORM_EXTERN ficlCell stackPop (ficlStack *stack) { return ficlStackPop(stack); } +FICL_PLATFORM_EXTERN void *stackPopPtr (ficlStack *stack) { return ficlStackPopPointer(stack); } +FICL_PLATFORM_EXTERN ficlUnsigned stackPopUNS (ficlStack *stack) { return ficlStackPopUnsigned(stack); } +FICL_PLATFORM_EXTERN ficlInteger stackPopINT (ficlStack *stack) { return ficlStackPopInteger(stack); } +FICL_PLATFORM_EXTERN void stackPush (ficlStack *stack, ficlCell cell) { ficlStackPush(stack, cell); } +FICL_PLATFORM_EXTERN void stackPushPtr (ficlStack *stack, void *pointer) { ficlStackPushPointer(stack, pointer); } +FICL_PLATFORM_EXTERN void stackPushUNS (ficlStack *stack, ficlUnsigned u) { ficlStackPushUnsigned(stack, u); } +FICL_PLATFORM_EXTERN void stackPushINT (ficlStack *stack, ficlInteger i) { ficlStackPushInteger(stack, i); } +FICL_PLATFORM_EXTERN void stackReset (ficlStack *stack) { ficlStackReset(stack); } +FICL_PLATFORM_EXTERN void stackRoll (ficlStack *stack, int n) { ficlStackRoll(stack, n); } +FICL_PLATFORM_EXTERN void stackSetTop (ficlStack *stack, ficlCell cell) { ficlStackSetTop(stack, cell); } +FICL_PLATFORM_EXTERN void stackStore (ficlStack *stack, int n, ficlCell cell) { ficlStackStore(stack, n, cell); } + +#if (FICL_WANT_FLOAT) +FICL_PLATFORM_EXTERN ficlFloat stackPopFloat (ficlStack *stack) { return ficlStackPopFloat(stack); } +FICL_PLATFORM_EXTERN void stackPushFloat(ficlStack *stack, ficlFloat f) { ficlStackPushFloat(stack, f); } +#endif + +FICL_PLATFORM_EXTERN int wordIsImmediate(ficlWord *word) { return ficlWordIsImmediate(word); } +FICL_PLATFORM_EXTERN int wordIsCompileOnly(ficlWord *word) { return ficlWordIsCompileOnly(word); } + + +FICL_PLATFORM_EXTERN void vmBranchRelative(ficlVm *vm, int offset) { ficlVmBranchRelative(vm, offset); } +FICL_PLATFORM_EXTERN ficlVm *vmCreate (ficlVm *vm, unsigned nPStack, unsigned nRStack) { return ficlVmCreate(vm, nPStack, nRStack); } +FICL_PLATFORM_EXTERN void vmDelete (ficlVm *vm) { ficlVmDestroy(vm); } +FICL_PLATFORM_EXTERN void vmExecute (ficlVm *vm, ficlWord *word) { ficlVmExecuteWord(vm, word); } +FICL_PLATFORM_EXTERN ficlDictionary *vmGetDict (ficlVm *vm) { return ficlVmGetDictionary(vm); } +FICL_PLATFORM_EXTERN char * vmGetString (ficlVm *vm, ficlCountedString *spDest, char delimiter) { return ficlVmGetString(vm, spDest, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmGetWord (ficlVm *vm) { return ficlVmGetWord(vm); } +FICL_PLATFORM_EXTERN ficlString vmGetWord0 (ficlVm *vm) { return ficlVmGetWord0(vm); } +FICL_PLATFORM_EXTERN int vmGetWordToPad (ficlVm *vm) { return ficlVmGetWordToPad(vm); } +FICL_PLATFORM_EXTERN ficlString vmParseString (ficlVm *vm, char delimiter) { return ficlVmParseString(vm, delimiter); } +FICL_PLATFORM_EXTERN ficlString vmParseStringEx(ficlVm *vm, char delimiter, char skipLeading) { return ficlVmParseStringEx(vm, delimiter, skipLeading); } +FICL_PLATFORM_EXTERN ficlCell vmPop (ficlVm *vm) { return ficlVmPop(vm); } +FICL_PLATFORM_EXTERN void vmPush (ficlVm *vm, ficlCell cell) { ficlVmPush(vm, cell); } +FICL_PLATFORM_EXTERN void vmPopIP (ficlVm *vm) { ficlVmPopIP(vm); } +FICL_PLATFORM_EXTERN void vmPushIP (ficlVm *vm, ficlIp newIP) { ficlVmPushIP(vm, newIP); } +FICL_PLATFORM_EXTERN void vmQuit (ficlVm *vm) { ficlVmQuit(vm); } +FICL_PLATFORM_EXTERN void vmReset (ficlVm *vm) { ficlVmReset(vm); } +FICL_PLATFORM_EXTERN void vmThrow (ficlVm *vm, int except) { ficlVmThrow(vm, except); } +FICL_PLATFORM_EXTERN void vmThrowErr (ficlVm *vm, char *fmt, ...) { va_list list; va_start(list, fmt); ficlVmThrowErrorVararg(vm, fmt, list); va_end(list); } + +FICL_PLATFORM_EXTERN void vmCheckStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->dataStack, popCells, pushCells); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void vmCheckFStack(ficlVm *vm, int popCells, int pushCells) { FICL_IGNORE(vm); FICL_IGNORE(popCells); FICL_IGNORE(pushCells); FICL_STACK_CHECK(vm->floatStack, popCells, pushCells); } +#endif + +FICL_PLATFORM_EXTERN void vmPushTib (ficlVm *vm, char *text, ficlInteger nChars, ficlTIB *pSaveTib) { ficlVmPushTib(vm, text, nChars, pSaveTib); } +FICL_PLATFORM_EXTERN void vmPopTib (ficlVm *vm, ficlTIB *pTib) { ficlVmPopTib(vm, pTib); } + +FICL_PLATFORM_EXTERN int isPowerOfTwo(ficlUnsigned u) { return ficlIsPowerOfTwo(u); } + +#if defined(_WIN32) +/* #SHEESH +** Why do Microsoft Meatballs insist on contaminating +** my namespace with their string functions??? +*/ +#pragma warning(disable: 4273) +#endif +char *ltoa(ficlInteger value, char *string, int radix ) { return ficlLtoa(value, string, radix); } +char *ultoa(ficlUnsigned value, char *string, int radix ) { return ficlUltoa(value, string, radix); } +char *strrev( char *string ) { return ficlStringReverse(string); } +#if defined(_WIN32) +#pragma warning(default: 4273) +#endif +FICL_PLATFORM_EXTERN char digit_to_char(int value) { return ficlDigitToCharacter(value); } +FICL_PLATFORM_EXTERN char *skipSpace(char *cp, char *end) { return ficlStringSkipSpace(cp, end); } +FICL_PLATFORM_EXTERN char *caseFold(char *cp) { return ficlStringCaseFold(cp); } +FICL_PLATFORM_EXTERN int strincmp(char *cp1, char *cp2, ficlUnsigned count) { return ficlStrincmp(cp1, cp2, count); } + +FICL_PLATFORM_EXTERN void hashForget (ficlHash *hash, void *where) { ficlHashForget(hash, where); } +FICL_PLATFORM_EXTERN ficlUnsigned16 hashHashCode (ficlString string) { return ficlHashCode(string); } +FICL_PLATFORM_EXTERN void hashInsertWord(ficlHash *hash, ficlWord *word) { ficlHashInsertWord(hash, word); } +FICL_PLATFORM_EXTERN ficlWord *hashLookup (ficlHash *hash, ficlString string, ficlUnsigned16 hashCode) { return ficlHashLookup(hash, string, hashCode); } +FICL_PLATFORM_EXTERN void hashReset (ficlHash *hash) { ficlHashReset(hash); } + + +FICL_PLATFORM_EXTERN void *alignPtr(void *ptr) { return ficlAlignPointer(ptr); } +FICL_PLATFORM_EXTERN void dictAbortDefinition(ficlDictionary *dictionary) { ficlDictionaryAbortDefinition(dictionary); } +FICL_PLATFORM_EXTERN void dictAlign (ficlDictionary *dictionary) { ficlDictionaryAlign(dictionary); } +FICL_PLATFORM_EXTERN int dictAllot (ficlDictionary *dictionary, int n) { ficlDictionaryAllot(dictionary, n); return 0; } +FICL_PLATFORM_EXTERN int dictAllotCells (ficlDictionary *dictionary, int cells) { ficlDictionaryAllotCells(dictionary, cells); return 0; } +FICL_PLATFORM_EXTERN void dictAppendCell (ficlDictionary *dictionary, ficlCell cell) { ficlDictionaryAppendCell(dictionary, cell); } +FICL_PLATFORM_EXTERN void dictAppendChar (ficlDictionary *dictionary, char c) { ficlDictionaryAppendCharacter(dictionary, c); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord (ficlDictionary *dictionary, + char *name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendPrimitive(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN ficlWord *dictAppendWord2(ficlDictionary *dictionary, + ficlString name, + ficlPrimitive code, + ficlUnsigned8 flags) + { return ficlDictionaryAppendWord(dictionary, name, code, flags); } +FICL_PLATFORM_EXTERN void dictAppendUNS (ficlDictionary *dictionary, ficlUnsigned u) { ficlDictionaryAppendUnsigned(dictionary, u); } +FICL_PLATFORM_EXTERN int dictCellsAvail (ficlDictionary *dictionary) { return ficlDictionaryCellsAvailable(dictionary); } +FICL_PLATFORM_EXTERN int dictCellsUsed (ficlDictionary *dictionary) { return ficlDictionaryCellsUsed(dictionary); } +FICL_PLATFORM_EXTERN void dictCheck (ficlDictionary *dictionary, ficlVm *vm, int n) { FICL_IGNORE(dictionary); FICL_IGNORE(vm); FICL_IGNORE(n); FICL_VM_DICTIONARY_CHECK(vm, dictionary, n); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreate(unsigned cells) { return ficlDictionaryCreate(NULL, cells); } +FICL_PLATFORM_EXTERN ficlDictionary *dictCreateHashed(unsigned cells, unsigned hash) { return ficlDictionaryCreateHashed(NULL, cells, hash); } +FICL_PLATFORM_EXTERN ficlHash *dictCreateWordlist(ficlDictionary *dictionary, int nBuckets) { return ficlDictionaryCreateWordlist(dictionary, nBuckets); } +FICL_PLATFORM_EXTERN void dictDelete (ficlDictionary *dictionary) { ficlDictionaryDestroy(dictionary); } +FICL_PLATFORM_EXTERN void dictEmpty (ficlDictionary *dictionary, unsigned nHash) { ficlDictionaryEmpty(dictionary, nHash); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlPrimitiveHashSummary(ficlVm *vm); +FICL_PLATFORM_EXTERN void dictHashSummary(ficlVm *vm) { ficlPrimitiveHashSummary(vm); } +#endif +FICL_PLATFORM_EXTERN int dictIncludes (ficlDictionary *dictionary, void *p) { return ficlDictionaryIncludes(dictionary, p); } +FICL_PLATFORM_EXTERN ficlWord *dictLookup (ficlDictionary *dictionary, ficlString name) { return ficlDictionaryLookup(dictionary, name); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlWord *ficlLookupLoc (ficlSystem *system, ficlString name) { return ficlDictionaryLookup(ficlSystemGetLocals(system), name); } +#endif +FICL_PLATFORM_EXTERN void dictResetSearchOrder(ficlDictionary *dictionary) { ficlDictionaryResetSearchOrder(dictionary); } +FICL_PLATFORM_EXTERN void dictSetFlags (ficlDictionary *dictionary, ficlUnsigned8 set, ficlUnsigned8 clear) { ficlDictionarySetFlags(dictionary, set); ficlDictionaryClearFlags(dictionary, clear); } +FICL_PLATFORM_EXTERN void dictSetImmediate(ficlDictionary *dictionary) { ficlDictionarySetImmediate(dictionary); } +FICL_PLATFORM_EXTERN void dictUnsmudge (ficlDictionary *dictionary) { ficlDictionaryUnsmudge(dictionary); } +FICL_PLATFORM_EXTERN ficlCell *dictWhere (ficlDictionary *dictionary) { return ficlDictionaryWhere(dictionary); } + +FICL_PLATFORM_EXTERN int ficlAddParseStep(ficlSystem *system, ficlWord *word) { return ficlSystemAddParseStep(system, word); } +FICL_PLATFORM_EXTERN void ficlAddPrecompiledParseStep(ficlSystem *system, char *name, ficlParseStep pStep) { ficlSystemAddPrimitiveParseStep(system, name, pStep); } +FICL_PLATFORM_EXTERN void ficlPrimitiveParseStepList(ficlVm *vm); +FICL_PLATFORM_EXTERN void ficlListParseSteps(ficlVm *vm) { ficlPrimitiveParseStepList(vm); } + +FICL_PLATFORM_EXTERN void ficlTermSystem(ficlSystem *system) { ficlSystemDestroy(system); } +FICL_PLATFORM_EXTERN int ficlEvaluate(ficlVm *vm, char *pText) { return ficlVmEvaluate(vm, pText); } +FICL_PLATFORM_EXTERN int ficlExec (ficlVm *vm, char *pText) { ficlString s; FICL_STRING_SET_FROM_CSTRING(s, pText); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecC(ficlVm *vm, char *pText, ficlInteger nChars) { ficlString s; FICL_STRING_SET_POINTER(s, pText); FICL_STRING_SET_LENGTH(s, nChars); return ficlVmExecuteString(vm, s); } +FICL_PLATFORM_EXTERN int ficlExecXT(ficlVm *vm, ficlWord *word) { return ficlVmExecuteXT(vm, word); } +FICL_PLATFORM_EXTERN void ficlFreeVM(ficlVm *vm) { ficlVmDestroy(vm); } + + + + + +static void thunkTextOut(ficlCallback *callback, char *text) + { + ficlCompatibilityOutputFunction outputFunction; + if ((callback->vm != NULL) && (callback->vm->thunkedTextout != NULL)) + outputFunction = callback->system->thunkedTextout; + else if (callback->system->thunkedTextout != NULL) + outputFunction = callback->system->thunkedTextout; + else + { + ficlCallbackDefaultTextOut(callback, text); + return; + } + ficlCompatibilityTextOutCallback(callback, text, outputFunction); + } + + +FICL_PLATFORM_EXTERN void vmSetTextOut(ficlVm *vm, ficlCompatibilityOutputFunction textOut) + { + vm->thunkedTextout = textOut; + ficlVmSetTextOut(vm, thunkTextOut); + } + +FICL_PLATFORM_EXTERN void vmTextOut (ficlVm *vm, char *text, int fNewline) + { + ficlVmTextOut(vm, text); + if (fNewline) + ficlVmTextOut(vm, "\n"); + } + + +FICL_PLATFORM_EXTERN void ficlTextOut (ficlVm *vm, char *text, int fNewline) + { + vmTextOut(vm, text, fNewline); + } + +extern ficlSystem *ficlSystemGlobal; +static defaultStackSize = FICL_DEFAULT_STACK_SIZE; +FICL_PLATFORM_EXTERN int ficlSetStackSize(int nStackCells) +{ + if (defaultStackSize < nStackCells) + defaultStackSize = nStackCells; + if ((ficlSystemGlobal != NULL) && (ficlSystemGlobal->stackSize < nStackCells)) + ficlSystemGlobal->stackSize = nStackCells; + return defaultStackSize; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystemEx(ficlSystemInformation *fsi) +{ + ficlSystem *returnValue; + ficlCompatibilityOutputFunction thunkedTextout; + ficlSystemInformation clone; + + memcpy(&clone, fsi, sizeof(clone)); + thunkedTextout = (ficlCompatibilityOutputFunction)clone.textOut; + clone.textOut = clone.errorOut = thunkTextOut; + + returnValue = ficlSystemCreate(&clone); + if (returnValue != NULL) + { + returnValue->thunkedTextout = thunkedTextout; + } + return returnValue; +} + + +FICL_PLATFORM_EXTERN ficlSystem *ficlInitSystem(int nDictCells) +{ + ficlSystemInformation fsi; + ficlSystemInformationInitialize(&fsi); + fsi.dictionarySize = nDictCells; + if (fsi.stackSize < defaultStackSize) + fsi.stackSize = defaultStackSize; + return ficlSystemCreate(&fsi); +} + + + + +FICL_PLATFORM_EXTERN ficlVm *ficlNewVM(ficlSystem *system) +{ + ficlVm *returnValue = ficlSystemCreateVm(system); + if (returnValue != NULL) + { + if ((returnValue->callback.textOut != NULL) && (returnValue->callback.textOut != thunkTextOut)) + { + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.textOut; + returnValue->callback.textOut = thunkTextOut; + } + if ((returnValue->callback.errorOut != NULL) && (returnValue->callback.errorOut != thunkTextOut)) + { + if (returnValue->thunkedTextout == NULL) + returnValue->thunkedTextout = (ficlCompatibilityOutputFunction)returnValue->callback.errorOut; + returnValue->callback.errorOut = thunkTextOut; + } + } + return returnValue; +} + + + +FICL_PLATFORM_EXTERN ficlWord *ficlLookup(ficlSystem *system, char *name) { return ficlSystemLookup(system, name); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetDict(ficlSystem *system) { return ficlSystemGetDictionary(system); } +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetEnv (ficlSystem *system) { return ficlSystemGetEnvironment(system); } +FICL_PLATFORM_EXTERN void ficlSetEnv (ficlSystem *system, char *name, ficlInteger value) { ficlDictionarySetConstant(ficlSystemGetDictionary(system), name, value); } +FICL_PLATFORM_EXTERN void ficlSetEnvD(ficlSystem *system, char *name, ficlInteger high, ficlInteger low) { ficl2Unsigned value; FICL_2UNSIGNED_SET(low, high, value); ficlDictionarySet2Constant(ficlSystemGetDictionary(system), name, FICL_2UNSIGNED_TO_2INTEGER(value)); } +#if FICL_WANT_LOCALS +FICL_PLATFORM_EXTERN ficlDictionary *ficlGetLoc (ficlSystem *system) { return ficlSystemGetLocals(system); } +#endif +FICL_PLATFORM_EXTERN int ficlBuild(ficlSystem *system, char *name, ficlPrimitive code, char flags) { ficlDictionary *dictionary = ficlSystemGetDictionary(system); ficlDictionaryLock(dictionary, FICL_TRUE); ficlDictionaryAppendPrimitive(dictionary, name, code, flags); ficlDictionaryLock(dictionary, FICL_FALSE); return 0; } +FICL_PLATFORM_EXTERN void ficlCompileCore(ficlSystem *system) { ficlSystemCompileCore(system); } +FICL_PLATFORM_EXTERN void ficlCompilePrefix(ficlSystem *system) { ficlSystemCompilePrefix(system); } +FICL_PLATFORM_EXTERN void ficlCompileSearch(ficlSystem *system) { ficlSystemCompileSearch(system); } +FICL_PLATFORM_EXTERN void ficlCompileSoftCore(ficlSystem *system) { ficlSystemCompileSoftCore(system); } +FICL_PLATFORM_EXTERN void ficlCompileTools(ficlSystem *system) { ficlSystemCompileTools(system); } +FICL_PLATFORM_EXTERN void ficlCompileFile(ficlSystem *system) { ficlSystemCompileFile(system); } +#if FICL_WANT_FLOAT +FICL_PLATFORM_EXTERN void ficlCompileFloat(ficlSystem *system) { ficlSystemCompileFloat(system); } +FICL_PLATFORM_EXTERN int ficlParseFloatNumber( ficlVm *vm, ficlString string) { return ficlVmParseFloatNumber(vm, string); } +#endif +#if FICL_WANT_PLATFORM +FICL_PLATFORM_EXTERN void ficlCompilePlatform(ficlSystem *system) { ficlSystemCompilePlatform(system); } +#endif +FICL_PLATFORM_EXTERN int ficlParsePrefix(ficlVm *vm, ficlString string) { return ficlVmParsePrefix(vm, string); } + +FICL_PLATFORM_EXTERN int ficlParseNumber(ficlVm *vm, ficlString string) { return ficlVmParseNumber(vm, string); } +FICL_PLATFORM_EXTERN void ficlTick(ficlVm *vm) { ficlPrimitiveTick(vm); } +FICL_PLATFORM_EXTERN void parseStepParen(ficlVm *vm) { ficlPrimitiveParseStepParen(vm); } + +FICL_PLATFORM_EXTERN int isAFiclWord(ficlDictionary *dictionary, ficlWord *word) { return ficlDictionaryIsAWord(dictionary, word); } + + +FICL_PLATFORM_EXTERN void buildTestInterface(ficlSystem *system) { ficlSystemCompileExtras(system); } + + Copied: vendor/ficl/4.1.0/dictionary.c (from r282803, vendor/ficl/dist/dictionary.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/ficl/4.1.0/dictionary.c Tue May 12 03:29:50 2015 (r282804, copy of r282803, vendor/ficl/dist/dictionary.c) @@ -0,0 +1,851 @@ +/******************************************************************* +** d i c t . c +** Forth Inspired Command Language - dictionary methods +** Author: John Sadler (john_sadler@alum.mit.edu) +** Created: 19 July 1997 +** $Id: dictionary.c,v 1.2 2010/09/12 15:14:52 asau Exp $ +*******************************************************************/ +/* +** This file implements the dictionary -- Ficl's model of +** memory management. All Ficl words are stored in the +** dictionary. A word is a named chunk of data with its +** associated code. Ficl treats all words the same, even +** precompiled ones, so your words become first-class +** extensions of the language. You can even define new +** control structures. +** +** 29 jun 1998 (sadler) added variable sized hash table support +*/ +/* +** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu) +** All rights reserved. +** +** Get the latest Ficl release at http://ficl.sourceforge.net +** +** I am interested in hearing from anyone who uses Ficl. If you have +** a problem, a success story, a defect, an enhancement request, or +** if you would like to contribute to the Ficl release, please +** contact me by email at the address above. +** +** L I C E N S E and D I S C L A I M E R +** +** Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions +** are met: +** 1. Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** 2. Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in the +** documentation and/or other materials provided with the distribution. +** +** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +** SUCH DAMAGE. +*/ + +#include +#include +#include +#include + +#include "ficl.h" + +#define FICL_SAFE_CALLBACK_FROM_SYSTEM(system) (((system) != NULL) ? &((system)->callback) : NULL) +#define FICL_SAFE_SYSTEM_FROM_DICTIONARY(dictionary) (((dictionary) != NULL) ? (dictionary)->system : NULL) +#define FICL_DICTIONARY_ASSERT(dictionary, expression) FICL_SYSTEM_ASSERT(FICL_SAFE_SYSTEM_FROM_DICTIONARY(dictionary), expression) + +/************************************************************************** + d i c t A b o r t D e f i n i t i o n +** Abort a definition in process: reclaim its memory and unlink it +** from the dictionary list. Assumes that there is a smudged +** definition in process...otherwise does nothing. +** NOTE: this function is not smart enough to unlink a word that +** has been successfully defined (ie linked into a hash). It +** only works for defs in process. If the def has been unsmudged, +** nothing happens. +**************************************************************************/ +void ficlDictionaryAbortDefinition(ficlDictionary *dictionary) +{ + ficlWord *word; + ficlDictionaryLock(dictionary, FICL_TRUE); + word = dictionary->smudge; + + if (word->flags & FICL_WORD_SMUDGED) + dictionary->here = (ficlCell *)word->name; + + ficlDictionaryLock(dictionary, FICL_FALSE); + return; +} + + +/************************************************************************** + d i c t A l i g n +** Align the dictionary's free space pointer +**************************************************************************/ +void ficlDictionaryAlign(ficlDictionary *dictionary) +{ + dictionary->here = ficlAlignPointer(dictionary->here); +} + + +/************************************************************************** + d i c t A l l o t +** Allocate or remove n chars of dictionary space, with +** checks for underrun and overrun +**************************************************************************/ +void ficlDictionaryAllot(ficlDictionary *dictionary, int n) +{ + char *here = (char *)dictionary->here; + here += n; + dictionary->here = FICL_POINTER_TO_CELL(here); +} + + +/************************************************************************** + d i c t A l l o t C e l l s +** Reserve space for the requested number of ficlCells in the +** dictionary. If nficlCells < 0 , removes space from the dictionary. +**************************************************************************/ +void ficlDictionaryAllotCells(ficlDictionary *dictionary, int nficlCells) +{ + dictionary->here += nficlCells; +} + + +/************************************************************************** + d i c t A p p e n d C e l l +** Append the specified ficlCell to the dictionary +**************************************************************************/ +void ficlDictionaryAppendCell(ficlDictionary *dictionary, ficlCell c) +{ + *dictionary->here++ = c; + return; +} + + +/************************************************************************** + d i c t A p p e n d C h a r +** Append the specified char to the dictionary +**************************************************************************/ +void ficlDictionaryAppendCharacter(ficlDictionary *dictionary, char c) +{ + char *here = (char *)dictionary->here; + *here++ = c; + dictionary->here = FICL_POINTER_TO_CELL(here); + return; +} + + +/************************************************************************** + d i c t A p p e n d U N S +** Append the specified ficlUnsigned to the dictionary +**************************************************************************/ +void ficlDictionaryAppendUnsigned(ficlDictionary *dictionary, ficlUnsigned u) +{ + *dictionary->here++ = FICL_LVALUE_TO_CELL(u); + return; +} + + +void *ficlDictionaryAppendData(ficlDictionary *dictionary, void *data, ficlInteger length) +{ + char *here = (char *)dictionary->here; + char *oldHere = here; + char *from = (char *)data; + + if (length == 0) + { + ficlDictionaryAlign(dictionary); + return (char *)dictionary->here; + } + + while (length) + { + *here++ = *from++; + length--; + } + + *here++ = '\0'; + + dictionary->here = FICL_POINTER_TO_CELL(here); + ficlDictionaryAlign(dictionary); + return oldHere; +} + + +/************************************************************************** + d i c t C o p y N a m e +** Copy up to FICL_NAME_LENGTH characters of the name specified by s into +** the dictionary starting at "here", then NULL-terminate the name, +** point "here" to the next available byte, and return the address of +** the beginning of the name. Used by dictAppendWord. +** N O T E S : +** 1. "here" is guaranteed to be aligned after this operation. +** 2. If the string has zero length, align and return "here" +**************************************************************************/ +char *ficlDictionaryAppendString(ficlDictionary *dictionary, ficlString s) +{ + void *data = FICL_STRING_GET_POINTER(s); + ficlInteger length = FICL_STRING_GET_LENGTH(s); + + if (length > FICL_NAME_LENGTH) + length = FICL_NAME_LENGTH; + + return ficlDictionaryAppendData(dictionary, data, length); +} + + +ficlWord *ficlDictionaryAppendConstantInstruction(ficlDictionary *dictionary, ficlString name, ficlInstruction instruction, ficlInteger value) +{ + ficlWord *word = ficlDictionaryAppendWord(dictionary, name, (ficlPrimitive)instruction, FICL_WORD_DEFAULT); + if (word != NULL) + ficlDictionaryAppendUnsigned(dictionary, value); + return word; +} + + +ficlWord *ficlDictionaryAppend2ConstantInstruction(ficlDictionary *dictionary, ficlString name, ficlInstruction instruction, ficl2Integer value) +{ + ficlWord *word = ficlDictionaryAppendWord(dictionary, name, (ficlPrimitive)instruction, FICL_WORD_DEFAULT); + if (word != NULL) + { + ficlDictionaryAppendUnsigned(dictionary, FICL_2UNSIGNED_GET_HIGH(value)); + ficlDictionaryAppendUnsigned(dictionary, FICL_2UNSIGNED_GET_LOW(value)); + } + return word; +} + + + +ficlWord *ficlDictionaryAppendConstant(ficlDictionary *dictionary, char *name, ficlInteger value) +{ + ficlString s; + FICL_STRING_SET_FROM_CSTRING(s, name); + return ficlDictionaryAppendConstantInstruction(dictionary, s, ficlInstructionConstantParen, value); +} + + + +ficlWord *ficlDictionaryAppend2Constant(ficlDictionary *dictionary, char *name, ficl2Integer value) +{ + ficlString s; + FICL_STRING_SET_FROM_CSTRING(s, name); + return ficlDictionaryAppend2ConstantInstruction(dictionary, s, ficlInstruction2ConstantParen, value); +} + + + +ficlWord *ficlDictionarySetConstantInstruction(ficlDictionary *dictionary, ficlString name, ficlInstruction instruction, ficlInteger value) +{ + ficlWord *word = ficlDictionaryLookup(dictionary, name); + + if (word == NULL) + { + word = ficlDictionaryAppendConstantInstruction(dictionary, name, instruction, value); + } + else + { + word->code = (ficlPrimitive)instruction; + word->param[0] = FICL_LVALUE_TO_CELL(value); + } + return word; +} + +ficlWord *ficlDictionarySetConstant(ficlDictionary *dictionary, char *name, ficlInteger value) +{ + ficlString s; + FICL_STRING_SET_FROM_CSTRING(s, name); + return ficlDictionarySetConstantInstruction(dictionary, s, ficlInstructionConstantParen, value); +} + +ficlWord *ficlDictionarySet2ConstantInstruction(ficlDictionary *dictionary, ficlString s, ficlInstruction instruction, ficl2Integer value) +{ + ficlWord *word; + word = ficlDictionaryLookup(dictionary, s); + + /* only reuse the existing word if we're sure it has space for a 2constant */ + if ((word != NULL) && + ((((ficlInstruction)word->code) == ficlInstruction2ConstantParen) +#if FICL_WANT_FLOAT + || + (((ficlInstruction)word->code) == ficlInstructionF2ConstantParen) +#endif /* FICL_WANT_FLOAT */ + ) + ) + { + word->code = (ficlPrimitive)instruction; + word->param[0].u = FICL_2UNSIGNED_GET_HIGH(value); + word->param[1].u = FICL_2UNSIGNED_GET_LOW(value); + } + else + { + word = ficlDictionaryAppend2ConstantInstruction(dictionary, s, instruction, value); + } + + return word; +} + + +ficlWord *ficlDictionarySet2Constant(ficlDictionary *dictionary, char *name, ficl2Integer value) +{ + ficlString s; + FICL_STRING_SET_FROM_CSTRING(s, name); + return ficlDictionarySet2ConstantInstruction(dictionary, s, ficlInstruction2ConstantParen, value); +} + + +ficlWord *ficlDictionarySetConstantString(ficlDictionary *dictionary, char *name, char *value) +{ + ficlString s; + ficl2Integer valueAs2Integer; + FICL_2INTEGER_SET(strlen(value), (intptr_t)value, valueAs2Integer); + FICL_STRING_SET_FROM_CSTRING(s, name); + + return ficlDictionarySet2ConstantInstruction(dictionary, s, ficlInstruction2ConstantParen, valueAs2Integer); +} + + + +/************************************************************************** + d i c t A p p e n d W o r d +** Create a new word in the dictionary with the specified +** ficlString, code, and flags. Does not require a NULL-terminated +** name. +**************************************************************************/ +ficlWord *ficlDictionaryAppendWord(ficlDictionary *dictionary, + ficlString name, + ficlPrimitive code, + ficlUnsigned8 flags) +{ + ficlUnsigned8 length = (ficlUnsigned8)FICL_STRING_GET_LENGTH(name); + char *nameCopy; + ficlWord *word; + + ficlDictionaryLock(dictionary, FICL_TRUE); + + /* + ** NOTE: ficlDictionaryAppendString advances "here" as a side-effect. + ** It must execute before word is initialized. + */ + nameCopy = ficlDictionaryAppendString(dictionary, name); + word = (ficlWord *)dictionary->here; + dictionary->smudge = word; + word->hash = ficlHashCode(name); + word->code = code; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Thu May 14 17:49:09 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 92B1B8B1; Thu, 14 May 2015 17:49:09 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7CC751BD3; Thu, 14 May 2015 17:49:09 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4EHn9rs053729; Thu, 14 May 2015 17:49:09 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4EHmvgc053579; Thu, 14 May 2015 17:48:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505141748.t4EHmvgc053579@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 May 2015 17:48:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282911 - in vendor/elftoolchain/dist: . addr2line ar brandelf common cxxfilt elfcopy elfdump findtextrel isa libdwarf libelf libelftc nm readelf size strings test/ar/plugin test/elfcop... X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 17:49:09 -0000 Author: emaste Date: Thu May 14 17:48:57 2015 New Revision: 282911 URL: https://svnweb.freebsd.org/changeset/base/282911 Log: Import ELF Tool Chain revision 3197 From http://svn.code.sf.net/p/elftoolchain/code Modified: vendor/elftoolchain/dist/INSTALL vendor/elftoolchain/dist/addr2line/addr2line.1 vendor/elftoolchain/dist/addr2line/addr2line.c vendor/elftoolchain/dist/ar/ar.1 vendor/elftoolchain/dist/ar/ar.5 vendor/elftoolchain/dist/ar/ar.c vendor/elftoolchain/dist/ar/ranlib.1 vendor/elftoolchain/dist/ar/read.c vendor/elftoolchain/dist/ar/write.c vendor/elftoolchain/dist/brandelf/brandelf.1 vendor/elftoolchain/dist/common/native-elf-format vendor/elftoolchain/dist/cxxfilt/c++filt.1 vendor/elftoolchain/dist/elfcopy/elfcopy.1 vendor/elftoolchain/dist/elfcopy/sections.c vendor/elftoolchain/dist/elfcopy/segments.c vendor/elftoolchain/dist/elfcopy/symbols.c vendor/elftoolchain/dist/elfdump/elfdump.1 vendor/elftoolchain/dist/elfdump/elfdump.c vendor/elftoolchain/dist/findtextrel/findtextrel.1 vendor/elftoolchain/dist/isa/isa.1 vendor/elftoolchain/dist/isa/isa.5 vendor/elftoolchain/dist/libdwarf/dwarf.3 vendor/elftoolchain/dist/libdwarf/dwarf_add_line_entry.3 vendor/elftoolchain/dist/libdwarf/dwarf_def_macro.3 vendor/elftoolchain/dist/libdwarf/dwarf_expand_frame_instructions.3 vendor/elftoolchain/dist/libdwarf/dwarf_formblock.3 vendor/elftoolchain/dist/libdwarf/dwarf_formflag.3 vendor/elftoolchain/dist/libdwarf/dwarf_formref.3 vendor/elftoolchain/dist/libdwarf/dwarf_formsig8.3 vendor/elftoolchain/dist/libdwarf/dwarf_formudata.3 vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_all_regs.3 vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_reg.3 vendor/elftoolchain/dist/libdwarf/dwarf_get_ranges.3 vendor/elftoolchain/dist/libdwarf/dwarf_hasattr.3 vendor/elftoolchain/dist/libdwarf/dwarf_next_cu_header.3 vendor/elftoolchain/dist/libdwarf/dwarf_producer_init.3 vendor/elftoolchain/dist/libdwarf/dwarf_whatattr.3 vendor/elftoolchain/dist/libelf/elf.3 vendor/elftoolchain/dist/libelf/elf_begin.3 vendor/elftoolchain/dist/libelf/elf_cntl.3 vendor/elftoolchain/dist/libelf/elf_getdata.3 vendor/elftoolchain/dist/libelf/elf_open.3 vendor/elftoolchain/dist/libelf/elf_update.c vendor/elftoolchain/dist/libelf/gelf.3 vendor/elftoolchain/dist/libelftc/elftc_demangle.3 vendor/elftoolchain/dist/libelftc/elftc_symbol_table_create.3 vendor/elftoolchain/dist/libelftc/libelftc_dem_gnu3.c vendor/elftoolchain/dist/nm/nm.1 vendor/elftoolchain/dist/readelf/readelf.1 vendor/elftoolchain/dist/readelf/readelf.c vendor/elftoolchain/dist/size/size.1 vendor/elftoolchain/dist/size/size.c vendor/elftoolchain/dist/strings/strings.1 vendor/elftoolchain/dist/test/ar/plugin/Makefile vendor/elftoolchain/dist/test/elfcopy/plugin/Makefile Modified: vendor/elftoolchain/dist/INSTALL ============================================================================== --- vendor/elftoolchain/dist/INSTALL Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/INSTALL Thu May 14 17:48:57 2015 (r282911) @@ -15,6 +15,7 @@ operating systems. ----------------- -------- ----------------------- `DragonFly BSD`_ 2.10.1 i386 FreeBSD_ v8.2 amd64 & i386 + FreeBSD_ v10.1 i386 Minix_ 3.0.2 i386 NetBSD_ v5.0.2 i386 OpenBSD_ v5.0 i386 @@ -75,6 +76,22 @@ Prerequisites % sudo pkg_add -r latex-pgf +:FreeBSD 10.1: + - The core libraries and utilities should build out of the box on + a stock install of FreeBSD. + + - To build and run the test suite: + + #. The current release of the `Test Execution Toolkit`_ needs to + be downloaded and unpacked into the ``test/tet/`` directory. + + #. The ``python`` and ``py27-yaml`` packages need to be installed:: + + % sudo pkg install python py27-yaml + + - Building additional documentation is not currently supported under + FreeBSD 10.1. + :Minix 3.2.0: - The following packages are pre-requisites for building the sources on Minix 3.2.0: @@ -299,7 +316,7 @@ website`_. .. _project website: http://elftoolchain.sourceforge.net/ -.. $Id: INSTALL 3165 2015-02-20 20:52:18Z emaste $ +.. $Id: INSTALL 3193 2015-05-04 17:47:14Z jkoshy $ .. Local Variables: .. mode: rst Modified: vendor/elftoolchain/dist/addr2line/addr2line.1 ============================================================================== --- vendor/elftoolchain/dist/addr2line/addr2line.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/addr2line/addr2line.1 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: addr2line.1 2066 2011-10-26 15:40:28Z jkoshy $ +.\" $Id: addr2line.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd July 25, 2010 .Os @@ -99,7 +99,7 @@ Print a help message. Print a version identifier and exit. .El .Sh OUTPUT FORMAT -If the +If the .Fl f option was not specified, .Nm @@ -156,4 +156,4 @@ its source file and line number use: The .Nm utility was written by -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . Modified: vendor/elftoolchain/dist/addr2line/addr2line.c ============================================================================== --- vendor/elftoolchain/dist/addr2line/addr2line.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/addr2line/addr2line.c Thu May 14 17:48:57 2015 (r282911) @@ -39,7 +39,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: addr2line.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: addr2line.c 3197 2015-05-12 21:01:31Z emaste $"); static struct option longopts[] = { {"target" , required_argument, NULL, 'b'}, @@ -84,6 +84,44 @@ version(void) exit(0); } +/* + * Handle DWARF 4 'offset from' DW_AT_high_pc. Although we don't + * fully support DWARF 4, some compilers (like FreeBSD Clang 3.5.1) + * generate DW_AT_high_pc as an offset from DW_AT_low_pc. + * + * "If the value of the DW_AT_high_pc is of class address, it is the + * relocated address of the first location past the last instruction + * associated with the entity; if it is of class constant, the value + * is an unsigned integer offset which when added to the low PC gives + * the address of the first location past the last instruction + * associated with the entity." + * + * DWARF4 spec, section 2.17.2. + */ +static int +handle_high_pc(Dwarf_Die die, Dwarf_Unsigned lopc, Dwarf_Unsigned *hipc) +{ + Dwarf_Error de; + Dwarf_Half form; + Dwarf_Attribute at; + int ret; + + ret = dwarf_attr(die, DW_AT_high_pc, &at, &de); + if (ret == DW_DLV_ERROR) { + warnx("dwarf_attr failed: %s", dwarf_errmsg(de)); + return (ret); + } + ret = dwarf_whatform(at, &form, &de); + if (ret == DW_DLV_ERROR) { + warnx("dwarf_whatform failed: %s", dwarf_errmsg(de)); + return (ret); + } + if (dwarf_get_form_class(2, 0, 0, form) == DW_FORM_CLASS_CONSTANT) + *hipc += lopc; + + return (DW_DLV_OK); +} + static void search_func(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr addr, const char **rlt_func) @@ -108,6 +146,8 @@ search_func(Dwarf_Debug dbg, Dwarf_Die d if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) || dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de)) goto cont_search; + if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK) + goto cont_search; if (addr < lopc || addr >= hipc) goto cont_search; @@ -202,6 +242,8 @@ translate(Dwarf_Debug dbg, const char* a * Check if the address falls into the PC range of * this CU. */ + if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK) + continue; if (addr < lopc || addr >= hipc) continue; } Modified: vendor/elftoolchain/dist/ar/ar.1 ============================================================================== --- vendor/elftoolchain/dist/ar/ar.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/ar.1 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: ar.1 2742 2012-12-10 18:47:36Z jkoshy $ +.\" $Id: ar.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd December 10, 2012 .Os @@ -194,11 +194,11 @@ from the archive specified by argument The archive's symbol table, if present, is updated to reflect the new contents of the archive. .It Fl D -When used in combination with the +When used in combination with the .Fl r or .Fl q -option, insert 0's instead of the real mtime, uid and gid values +option, insert 0's instead of the real mtime, uid and gid values and 0644 instead of file mode from the members named by arguments .Ar . This ensures that checksums on the resulting archives are reproducible @@ -346,7 +346,7 @@ or options, .Nm gives a file-by-file description of the archive modification being -performed, which consists of three white-space seperated fields: +performed, which consists of three white-space separated fields: the option letter, a dash .Dq "-" , and the file name. @@ -554,7 +554,7 @@ using MRI librarian commands, use the fo .Bd -literal -offset indent create ex.a * specify the output archive addmod ex1.o ex2.o * add modules -save * save pending changes +save * save pending changes end * exit the utility .Ed .Sh DIAGNOSTICS @@ -594,7 +594,7 @@ An command first appeared in AT&T UNIX Version 1. In .Fx 8.0 , -.An "Kai Wang" Aq kaiw@FreeBSD.org +.An Kai Wang Aq Mt kaiw@FreeBSD.org reimplemented .Nm using the Modified: vendor/elftoolchain/dist/ar/ar.5 ============================================================================== --- vendor/elftoolchain/dist/ar/ar.5 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/ar.5 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: ar.5 2066 2011-10-26 15:40:28Z jkoshy $ +.\" $Id: ar.5 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd November 28, 2010 .Os @@ -126,7 +126,7 @@ The BSD and SVR4/GNU variants use differ names for members. .Bl -tag -width "SVR4/GNU" .It "BSD" -File names that are upto 16 bytes long and which do not contain +File names that are up to 16 bytes long and which do not contain embedded spaces are stored directly in the .Ar ar_name field of the archive header. @@ -164,7 +164,7 @@ ASCII .Dq "A BC D" .Pc . .It "SVR4/GNU" -File names that are upto 15 characters long are stored directly in the +File names that are up to 15 characters long are stored directly in the .Ar ar_name field of the header, terminated by a .Dq Li / @@ -237,7 +237,7 @@ the ASCII string No padding is used to separate adjacent file names. .Ss "Archive Symbol Tables" Archive symbol tables are used to speed up link editing by providing a -mapping between the program symbols defined in the archive +mapping between the program symbols defined in the archive and the corresponding archive members. Archive symbol tables are managed by the .Xr ranlib 1 Modified: vendor/elftoolchain/dist/ar/ar.c ============================================================================== --- vendor/elftoolchain/dist/ar/ar.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/ar.c Thu May 14 17:48:57 2015 (r282911) @@ -72,7 +72,7 @@ #include "ar.h" -ELFTC_VCSID("$Id: ar.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: ar.c 3183 2015-04-10 16:18:42Z emaste $"); enum options { @@ -117,7 +117,7 @@ main(int argc, char **argv) /* * Act like ranlib if our name ends in "ranlib"; this - * accomodates names like "arm-freebsd7.1-ranlib", + * accommodates names like "arm-freebsd7.1-ranlib", * "bsdranlib", etc. */ len = strlen(bsdar->progname); Modified: vendor/elftoolchain/dist/ar/ranlib.1 ============================================================================== --- vendor/elftoolchain/dist/ar/ranlib.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/ranlib.1 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: ranlib.1 2739 2012-12-09 17:07:46Z jkoshy $ +.\" $Id: ranlib.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd December 9, 2012 .Os @@ -77,7 +77,7 @@ command first appeared in AT&T UNIX Vers .Pp In .Fx 8.0 , -.An "Kai Wang" Aq kaiw@FreeBSD.org +.An Kai Wang Aq Mt kaiw@FreeBSD.org reimplemented .Nm using the Modified: vendor/elftoolchain/dist/ar/read.c ============================================================================== --- vendor/elftoolchain/dist/ar/read.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/read.c Thu May 14 17:48:57 2015 (r282911) @@ -38,7 +38,7 @@ #include "ar.h" -ELFTC_VCSID("$Id: read.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: read.c 3180 2015-04-09 15:13:57Z emaste $"); /* * Handle read modes: 'x', 't' and 'p'. @@ -181,7 +181,7 @@ ar_read_archive(struct bsdar *bsdar, int continue; } /* Basic path security flags. */ - flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS | \ + flags = ARCHIVE_EXTRACT_SECURE_SYMLINKS | ARCHIVE_EXTRACT_SECURE_NODOTDOT; if (bsdar->options & AR_O) flags |= ARCHIVE_EXTRACT_TIME; Modified: vendor/elftoolchain/dist/ar/write.c ============================================================================== --- vendor/elftoolchain/dist/ar/write.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/ar/write.c Thu May 14 17:48:57 2015 (r282911) @@ -40,7 +40,7 @@ #include "ar.h" -ELFTC_VCSID("$Id: write.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: write.c 3183 2015-04-10 16:18:42Z emaste $"); #define _ARMAG_LEN 8 /* length of the magic string */ #define _ARHDR_LEN 60 /* length of the archive header */ @@ -69,7 +69,7 @@ static void write_objs(struct bsdar *bsd /* * Create an object from a file, and return the created object * descriptor. Return NULL if either an error occurs, or if the '-u' - * option was specifed and the member is not newer than the existing + * option was specified and the member is not newer than the existing * one in the archive. */ static struct ar_obj * @@ -426,7 +426,7 @@ ar_write_archive(struct bsdar *bsdar, in if (mode == 'A') { /* * Read objects from the target archive of the - * 'ADDLIB' command. If there are members spcified in + * 'ADDLIB' command. If there are members specified in * 'argv', read those members only, otherwise the * entire archive will be read. */ @@ -447,7 +447,7 @@ ar_write_archive(struct bsdar *bsdar, in /* * If we cannot find the position specified by the - * user, sliently insert objects at the tail of the + * user, silently insert objects at the tail of the * list. */ if (pos == NULL) Modified: vendor/elftoolchain/dist/brandelf/brandelf.1 ============================================================================== --- vendor/elftoolchain/dist/brandelf/brandelf.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/brandelf/brandelf.1 Thu May 14 17:48:57 2015 (r282911) @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/usr.bin/brandelf/brandelf.1,v 1.17 2007/03/09 14:36:18 ru Exp $ -.\" $Id: brandelf.1 3101 2014-10-27 22:24:40Z jkoshy $ +.\" $Id: brandelf.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd October 27, 2014 .Dt BRANDELF 1 @@ -148,4 +148,4 @@ manual page first appeared in .Fx 2.2 . .Sh AUTHORS This manual page was written by -.An John-Mark Gurney Aq gurney_j@efn.org . +.An John-Mark Gurney Aq Mt gurney_j@efn.org . Modified: vendor/elftoolchain/dist/common/native-elf-format ============================================================================== --- vendor/elftoolchain/dist/common/native-elf-format Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/common/native-elf-format Thu May 14 17:48:57 2015 (r282911) @@ -1,6 +1,6 @@ #!/bin/sh # -# $Id: native-elf-format 3167 2015-02-24 19:10:08Z emaste $ +# $Id: native-elf-format 3186 2015-04-16 22:16:40Z emaste $ # # Find the native ELF format for a host platform by compiling a # test object and examining the resulting object. @@ -33,7 +33,7 @@ $1 ~ "Data:" { $1 ~ "Machine:" { if (match($0, "Intel.*386")) { elfarch = "EM_386"; - } else if (match($0, ".*X86-64")) { + } else if (match($0, ".*[xX]86-64")) { elfarch = "EM_X86_64"; } else { elfarch = "unknown"; Modified: vendor/elftoolchain/dist/cxxfilt/c++filt.1 ============================================================================== --- vendor/elftoolchain/dist/cxxfilt/c++filt.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/cxxfilt/c++filt.1 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: c++filt.1 2175 2011-11-16 05:51:49Z jkoshy $ +.\" $Id: c++filt.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd August 24, 2011 .Os @@ -106,4 +106,4 @@ and exit. The .Nm utility was written by -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . Modified: vendor/elftoolchain/dist/elfcopy/elfcopy.1 ============================================================================== --- vendor/elftoolchain/dist/elfcopy/elfcopy.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfcopy/elfcopy.1 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elfcopy.1 3173 2015-03-27 16:46:13Z emaste $ +.\" $Id: elfcopy.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd March 27, 2015 .Os @@ -330,4 +330,4 @@ Do not copy symbols that are not needed .Sh HISTORY .Nm has been implemented by -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . Modified: vendor/elftoolchain/dist/elfcopy/sections.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/sections.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfcopy/sections.c Thu May 14 17:48:57 2015 (r282911) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: sections.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: sections.c 3185 2015-04-11 08:56:34Z kaiwang27 $"); static void add_gnu_debuglink(struct elfcopy *ecp); static uint32_t calc_crc32(const char *p, size_t len, uint32_t crc); @@ -1223,6 +1223,14 @@ update_shdr(struct elfcopy *ecp, int upd osh.sh_info != 0) osh.sh_info = ecp->secndx[osh.sh_info]; + /* + * sh_info of SHT_GROUP section needs to point to the correct + * string in the symbol table. + */ + if (s->type == SHT_GROUP && (ecp->flags & SYMTAB_EXIST) && + (ecp->flags & SYMTAB_INTACT) == 0) + osh.sh_info = ecp->symndx[osh.sh_info]; + if (!gelf_update_shdr(s->os, &osh)) errx(EXIT_FAILURE, "gelf_update_shdr() failed: %s", elf_errmsg(-1)); Modified: vendor/elftoolchain/dist/elfcopy/segments.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/segments.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfcopy/segments.c Thu May 14 17:48:57 2015 (r282911) @@ -34,7 +34,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: segments.c 3177 2015-03-30 18:19:41Z emaste $"); +ELFTC_VCSID("$Id: segments.c 3196 2015-05-12 17:33:48Z emaste $"); static void insert_to_inseg_list(struct segment *seg, struct section *sec); @@ -442,7 +442,7 @@ copy_phdr(struct elfcopy *ecp) s = seg->v_sec[i]; seg->msz = s->vma + s->sz - seg->addr; if (s->type != SHT_NOBITS) - seg->fsz = seg->msz; + seg->fsz = s->off + s->sz - seg->off; } } Modified: vendor/elftoolchain/dist/elfcopy/symbols.c ============================================================================== --- vendor/elftoolchain/dist/elfcopy/symbols.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfcopy/symbols.c Thu May 14 17:48:57 2015 (r282911) @@ -33,7 +33,7 @@ #include "elfcopy.h" -ELFTC_VCSID("$Id: symbols.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: symbols.c 3191 2015-05-04 17:07:01Z jkoshy $"); /* Symbol table buffer structure. */ struct symbuf { @@ -1090,7 +1090,7 @@ str_hash(const char *s) { uint32_t hash; - for (hash = 2166136261; *s; s++) + for (hash = 2166136261UL; *s; s++) hash = (hash ^ *s) * 16777619; return (hash & (STHASHSIZE - 1)); Modified: vendor/elftoolchain/dist/elfdump/elfdump.1 ============================================================================== --- vendor/elftoolchain/dist/elfdump/elfdump.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfdump/elfdump.1 Thu May 14 17:48:57 2015 (r282911) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD: src/usr.bin/elfdump/elfdump.1,v 1.6 2005/01/18 13:43:48 ru Exp $ -.\" $Id: elfdump.1 2069 2011-10-26 15:53:48Z jkoshy $ +.\" $Id: elfdump.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd August 25, 2011 .Dt ELFDUMP 1 @@ -141,14 +141,14 @@ The .Nm utility was written by -.An Jake Burkholder Aq jake@FreeBSD.org . +.An Jake Burkholder Aq Mt jake@FreeBSD.org . Later it was rewritten based on the libelf library. This manual page was written by -.An David O'Brien Aq obrien@FreeBSD.org . +.An David O'Brien Aq Mt obrien@FreeBSD.org . .Pp -.An Kai Wang Aq kaiw@FreeBSD.org +.An Kai Wang Aq Mt kaiw@FreeBSD.org rewrote it using the .Lb libelf and implemented additional functionality. Modified: vendor/elftoolchain/dist/elfdump/elfdump.c ============================================================================== --- vendor/elftoolchain/dist/elfdump/elfdump.c Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/elfdump/elfdump.c Thu May 14 17:48:57 2015 (r282911) @@ -50,7 +50,7 @@ #include "_elftc.h" -ELFTC_VCSID("$Id: elfdump.c 3174 2015-03-27 17:13:41Z emaste $"); +ELFTC_VCSID("$Id: elfdump.c 3189 2015-04-20 17:02:01Z emaste $"); #if defined(ELFTC_NEED_ELF_NOTE_DEFINITION) #include "native-elf-format.h" @@ -933,12 +933,11 @@ main(int ac, char **av) errx(EXIT_FAILURE, "ELF library initialization failed: %s", elf_errmsg(-1)); - for (i = 0; i < ac; i++) - if (av[i] != NULL) { - ed->filename = av[i]; - ed->archive = NULL; - elf_print_object(ed); - } + for (i = 0; i < ac; i++) { + ed->filename = av[i]; + ed->archive = NULL; + elf_print_object(ed); + } exit(EXIT_SUCCESS); } Modified: vendor/elftoolchain/dist/findtextrel/findtextrel.1 ============================================================================== --- vendor/elftoolchain/dist/findtextrel/findtextrel.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/findtextrel/findtextrel.1 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: findtextrel.1 2069 2011-10-26 15:53:48Z jkoshy $ +.\" $Id: findtextrel.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd August 25, 2011 .Os @@ -101,4 +101,4 @@ toolset from Red Hat, Inc. This implementation of the .Nm utility was created by -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . Modified: vendor/elftoolchain/dist/isa/isa.1 ============================================================================== --- vendor/elftoolchain/dist/isa/isa.1 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/isa/isa.1 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ \" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, \" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: isa.1 2889 2013-01-13 15:36:04Z jkoshy $ +.\" $Id: isa.1 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd January 13, 2013 .Os @@ -237,8 +237,7 @@ Elftoolchain project. The .Xr isa 1 utility was written by -.An Joseph Koshy -.Aq jkoshy@users.sourceforge.net . +.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net . .Sh BUGS The .Nm Modified: vendor/elftoolchain/dist/isa/isa.5 ============================================================================== --- vendor/elftoolchain/dist/isa/isa.5 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/isa/isa.5 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, .\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.\" $Id: isa.5 2900 2013-01-16 12:27:01Z jkoshy $ +.\" $Id: isa.5 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd January 16, 2013 .Os @@ -352,8 +352,7 @@ Elftoolchain project. The .Xr isa 1 utility was written by -.An Joseph Koshy -.Aq jkoshy@users.sourceforge.net . +.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net . .Sh BUGS The .Nm Modified: vendor/elftoolchain/dist/libdwarf/dwarf.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf.3 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: dwarf.3 3130 2014-12-21 20:06:29Z jkoshy $ +.\" $Id: dwarf.3 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd December 21, 2014 .Os @@ -44,7 +44,7 @@ is defined by the DWARF standard, see .Xr dwarf 4 . .Pp The -.Xr DWARF 3 +.Xr DWARF 3 API has two parts: .Bl -bullet .It @@ -349,7 +349,7 @@ Retrieve a debugging information entry g .It Fn dwarf_siblingof , Fn dwarf_siblingof_b Retrieve the sibling descriptor for a debugging information entry. .It Fn dwarf_srclang -Retrive the source language attribute for a debugging information +Retrieve the source language attribute for a debugging information entry. .It Fn dwarf_tag Retrieve the tag for a debugging information entry. @@ -742,12 +742,12 @@ The DWARF standard is defined by The DWARF(3) API originated at Silicon Graphics Inc. .Pp A BSD-licensed implementation of a subset of the API was written by -.An "John Birrell" Aq jb@FreeBSD.org +.An John Birrell Aq Mt jb@FreeBSD.org for the FreeBSD project. The implementation was subsequently revised and completed by -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . .Pp Manual pages for this implementation were written by -.An "Joseph Koshy" Aq jkoshy@users.sourceforge.net +.An Joseph Koshy Aq Mt jkoshy@users.sourceforge.net and -.An "Kai Wang" Aq kaiwang27@users.sourceforge.net . +.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net . Modified: vendor/elftoolchain/dist/libdwarf/dwarf_add_line_entry.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_add_line_entry.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_add_line_entry.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_add_line_entry.3 2953 2013-06-30 20:21:38Z kaiwang27 $ +.\" $Id: dwarf_add_line_entry.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd June 30, 2013 .Os @@ -66,7 +66,8 @@ Valid source file indices are those retu .Pp Argument .Ar off -specifies a relocatable program address. The ELF symbol to be used +specifies a relocatable program address. +The ELF symbol to be used for relocation is set by a prior call to the function .Xr dwarf_lne_set_address 3 . .Pp Modified: vendor/elftoolchain/dist/libdwarf/dwarf_def_macro.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_def_macro.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_def_macro.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_def_macro.3 2122 2011-11-09 15:35:14Z jkoshy $ +.\" $Id: dwarf_def_macro.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd November 9, 2011 .Os @@ -72,7 +72,7 @@ Argument .Ar value should point to a NUL-terminated string containing the value of the macro. -If the macro doesn't have a value, argument +If the macro does not have a value, argument .Ar value should be set to NULL. .Pp Modified: vendor/elftoolchain/dist/libdwarf/dwarf_expand_frame_instructions.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_expand_frame_instructions.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_expand_frame_instructions.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,14 +22,14 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_expand_frame_instructions.3 2122 2011-11-09 15:35:14Z jkoshy $ +.\" $Id: dwarf_expand_frame_instructions.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd November 9, 2011 .Os .Dt DWARF_EXPAND_FRAME_INSTRUCTIONS 3 .Sh NAME .Nm dwarf_expand_frame_instructions -.Nd expand frame instructions +.Nd expand frame instructions .Sh LIBRARY .Lb libdwarf .Sh SYNOPSIS Modified: vendor/elftoolchain/dist/libdwarf/dwarf_formblock.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_formblock.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_formblock.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_formblock.3 2073 2011-10-27 03:30:47Z jkoshy $ +.\" $Id: dwarf_formblock.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd July 23, 2010 .Os @@ -69,7 +69,7 @@ the DWARF(3) library. The application should not attempt to free this memory area. Portable code may indicate that the memory area is to be freed by -by using +using .Xr dwarf_dealloc 3 . .Sh RETURN VALUES Function Modified: vendor/elftoolchain/dist/libdwarf/dwarf_formflag.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_formflag.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_formflag.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_formflag.3 2073 2011-10-27 03:30:47Z jkoshy $ +.\" $Id: dwarf_formflag.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd June 21, 2010 .Os @@ -58,7 +58,7 @@ or If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES Function .Fn dwarf_formflag Modified: vendor/elftoolchain/dist/libdwarf/dwarf_formref.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_formref.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_formref.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_formref.3 2073 2011-10-27 03:30:47Z jkoshy $ +.\" $Id: dwarf_formref.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd June 21, 2010 .Os @@ -101,7 +101,7 @@ ELF section. If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES These functions return .Dv DW_DLV_OK Modified: vendor/elftoolchain/dist/libdwarf/dwarf_formsig8.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_formsig8.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_formsig8.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_formsig8.3 2073 2011-10-27 03:30:47Z jkoshy $ +.\" $Id: dwarf_formsig8.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd July 24, 2010 .Os @@ -56,7 +56,7 @@ must be If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES Function .Fn dwarf_formsig8 Modified: vendor/elftoolchain/dist/libdwarf/dwarf_formudata.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_formudata.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_formudata.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_formudata.3 2073 2011-10-27 03:30:47Z jkoshy $ +.\" $Id: dwarf_formudata.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd June 21, 2010 .Os @@ -88,7 +88,7 @@ and If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES These functions return .Dv DW_DLV_OK Modified: vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_all_regs.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_all_regs.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_all_regs.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_get_fde_info_for_all_regs.3 2071 2011-10-27 03:20:00Z jkoshy $ +.\" $Id: dwarf_get_fde_info_for_all_regs.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd June 4, 2011 .Os @@ -90,7 +90,8 @@ typedef struct { For each of the register rules returned, the .Va dw_offset_relevant -field is set to 1 if the register rule has a offset value. The +field is set to 1 if the register rule has a offset value. +The .Va dw_regnum field is set to the register number associated with the regsiter rule. The Modified: vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_reg.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_reg.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_get_fde_info_for_reg.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_get_fde_info_for_reg.3 2071 2011-10-27 03:20:00Z jkoshy $ +.\" $Id: dwarf_get_fde_info_for_reg.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd June 4, 2011 .Os @@ -99,7 +99,7 @@ counter address associated with the regi If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Ss COMPATIBILITY Function .Fn dwarf_get_fde_info_for_reg Modified: vendor/elftoolchain/dist/libdwarf/dwarf_get_ranges.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_get_ranges.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_get_ranges.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_get_ranges.3 2122 2011-11-09 15:35:14Z jkoshy $ +.\" $Id: dwarf_get_ranges.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd November 9, 2011 .Os @@ -137,7 +137,7 @@ For this type of entry, the field .Va dwr_addr1 is the value of the largest representable address offset, and .Va dwr_addr2 -is a base address for the begining and ending address offsets of +is a base address for the beginning and ending address offsets of subsequent address range entries in the list. .It Dv DW_RANGES_END An end of list mark. Modified: vendor/elftoolchain/dist/libdwarf/dwarf_hasattr.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_hasattr.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_hasattr.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_hasattr.3 3142 2015-01-29 23:11:14Z jkoshy $ +.\" $Id: dwarf_hasattr.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd April 17, 2010 .Os @@ -64,7 +64,7 @@ If the named attribute is not present, a If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES On success, function .Fn dwarf_hasattr Modified: vendor/elftoolchain/dist/libdwarf/dwarf_next_cu_header.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_next_cu_header.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_next_cu_header.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_next_cu_header.3 3128 2014-12-21 20:06:22Z jkoshy $ +.\" $Id: dwarf_next_cu_header.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd December 21, 2014 .Os @@ -220,8 +220,7 @@ unit in the section. .Ss Iterating Through Type Units in a Debug Context When a DWARF debug context is allocated using .Xr dwarf_init 3 , -an internal pointer assoicated with the context will point to the -fisrt +an internal pointer associated with the context will point to the first .Dq \&.debug_types section found in the debug object. The first call to function Modified: vendor/elftoolchain/dist/libdwarf/dwarf_producer_init.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_producer_init.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_producer_init.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_producer_init.3 2074 2011-10-27 03:34:33Z jkoshy $ +.\" $Id: dwarf_producer_init.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd August 20, 2011 .Os @@ -58,7 +58,7 @@ descriptor representing a DWARF producer .Pp The argument .Ar errhand -should contain the adddress of a function to be called in case of an +should contain the address of a function to be called in case of an error. If this argument is .Dv NULL , Modified: vendor/elftoolchain/dist/libdwarf/dwarf_whatattr.3 ============================================================================== --- vendor/elftoolchain/dist/libdwarf/dwarf_whatattr.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libdwarf/dwarf_whatattr.3 Thu May 14 17:48:57 2015 (r282911) @@ -22,7 +22,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $Id: dwarf_whatattr.3 3142 2015-01-29 23:11:14Z jkoshy $ +.\" $Id: dwarf_whatattr.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd May 22, 2010 .Os @@ -51,7 +51,7 @@ and writes it to the location pointed to If argument .Ar err is not NULL, it will be used to return an error descriptor in case -of an error. +of an error. .Sh RETURN VALUES On success, function .Fn dwarf_whatattr Modified: vendor/elftoolchain/dist/libelf/elf.3 ============================================================================== --- vendor/elftoolchain/dist/libelf/elf.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libelf/elf.3 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf.3 3142 2015-01-29 23:11:14Z jkoshy $ +.\" $Id: elf.3 3195 2015-05-12 17:22:19Z emaste $ .\" .Dd July 28, 2014 .Os @@ -555,7 +555,7 @@ flag on an ELF descriptor using .Xr elf_flagelf 3 , following which the library will use the data offsets and alignments specified by the application when laying out the file. -Application control of file layout is described further in the +Application control of file layout is described further in the .Xr elf_update 3 manual page. .Pp @@ -608,5 +608,4 @@ The current implementation of the ELF(3) .Fx 7.0 . .Sh AUTHORS The ELF library was written by -.An "Joseph Koshy" -.Aq jkoshy@FreeBSD.org . +.An Joseph Koshy Aq Mt jkoshy@FreeBSD.org . Modified: vendor/elftoolchain/dist/libelf/elf_begin.3 ============================================================================== --- vendor/elftoolchain/dist/libelf/elf_begin.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libelf/elf_begin.3 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_begin.3 2313 2011-12-11 06:19:24Z jkoshy $ +.\" $Id: elf_begin.3 3182 2015-04-10 16:08:10Z emaste $ .\" .Dd December 11, 2011 .Os @@ -272,7 +272,7 @@ was created. .It Bq Er ELF_E_ARGUMENT An .Xr ar 1 -archive was opened with with +archive was opened with .Ar cmd set to .Dv ELF_C_RDWR . Modified: vendor/elftoolchain/dist/libelf/elf_cntl.3 ============================================================================== --- vendor/elftoolchain/dist/libelf/elf_cntl.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libelf/elf_cntl.3 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_cntl.3 289 2009-01-08 08:26:08Z jkoshy $ +.\" $Id: elf_cntl.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd August 9, 2006 .Os Modified: vendor/elftoolchain/dist/libelf/elf_getdata.3 ============================================================================== --- vendor/elftoolchain/dist/libelf/elf_getdata.3 Thu May 14 17:37:10 2015 (r282910) +++ vendor/elftoolchain/dist/libelf/elf_getdata.3 Thu May 14 17:48:57 2015 (r282911) @@ -21,7 +21,7 @@ .\" out of the use of this software, even if advised of the possibility of .\" such damage. .\" -.\" $Id: elf_getdata.3 1766 2011-08-22 06:01:03Z jkoshy $ +.\" $Id: elf_getdata.3 3181 2015-04-10 13:22:51Z emaste $ .\" .Dd January 26, 2011 .Os *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-vendor@FreeBSD.ORG Thu May 14 17:50:21 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68EF09FB; Thu, 14 May 2015 17:50:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3D9ED1BE5; Thu, 14 May 2015 17:50:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4EHoLcu055626; Thu, 14 May 2015 17:50:21 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4EHoLLv055625; Thu, 14 May 2015 17:50:21 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201505141750.t4EHoLLv055625@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 14 May 2015 17:50:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282913 - vendor/elftoolchain/elftoolchain-r3197 X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 17:50:21 -0000 Author: emaste Date: Thu May 14 17:50:20 2015 New Revision: 282913 URL: https://svnweb.freebsd.org/changeset/base/282913 Log: Tag elftoolchain-r3197 Added: - copied from r282912, vendor/elftoolchain/dist/ Directory Properties: vendor/elftoolchain/elftoolchain-r3197/ (props changed) From owner-svn-src-vendor@FreeBSD.ORG Thu May 14 21:33:34 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3B5C1374; Thu, 14 May 2015 21:33:34 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0F18A16EA; Thu, 14 May 2015 21:33:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4ELXXnn068288; Thu, 14 May 2015 21:33:33 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4ELXXqA068287; Thu, 14 May 2015 21:33:33 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505142133.t4ELXXqA068287@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 14 May 2015 21:33:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282927 - vendor/libarchive/dist/libarchive X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 21:33:34 -0000 Author: delphij Date: Thu May 14 21:33:33 2015 New Revision: 282927 URL: https://svnweb.freebsd.org/changeset/base/282927 Log: Apply upstream changeset 3865cf2: Issue 394: Segfault when reading malformed old-style cpio archives Root cause here was an implicit cast that resulted in reading very large file sizes as negative numbers. Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:30:36 2015 (r282926) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:33:33 2015 (r282927) @@ -198,7 +198,7 @@ static int archive_read_format_cpio_read static int archive_read_format_cpio_read_header(struct archive_read *, struct archive_entry *); static int archive_read_format_cpio_skip(struct archive_read *); -static int be4(const unsigned char *); +static int64_t be4(const unsigned char *); static int find_odc_header(struct archive_read *); static int find_newc_header(struct archive_read *); static int header_bin_be(struct archive_read *, struct cpio *, @@ -213,7 +213,7 @@ static int header_afiol(struct archive_r struct archive_entry *, size_t *, size_t *); static int is_octal(const char *, size_t); static int is_hex(const char *, size_t); -static int le4(const unsigned char *); +static int64_t le4(const unsigned char *); static int record_hardlink(struct archive_read *a, struct cpio *cpio, struct archive_entry *entry); @@ -944,17 +944,17 @@ archive_read_format_cpio_cleanup(struct return (ARCHIVE_OK); } -static int +static int64_t le4(const unsigned char *p) { - return ((p[0]<<16) + (p[1]<<24) + (p[2]<<0) + (p[3]<<8)); + return ((p[0] << 16) + (((int64_t)p[1]) << 24) + (p[2] << 0) + (p[3] << 8)); } -static int +static int64_t be4(const unsigned char *p) { - return ((p[0]<<24) + (p[1]<<16) + (p[2]<<8) + (p[3])); + return ((((int64_t)p[0]) << 24) + (p[1] << 16) + (p[2] << 8) + (p[3])); } /* From owner-svn-src-vendor@FreeBSD.ORG Thu May 14 21:34:21 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 78FD94CF; Thu, 14 May 2015 21:34:21 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6752B16F4; Thu, 14 May 2015 21:34:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4ELYLQV068431; Thu, 14 May 2015 21:34:21 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4ELYLbw068430; Thu, 14 May 2015 21:34:21 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505142134.t4ELYLbw068430@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 14 May 2015 21:34:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282928 - vendor/libarchive/dist/libarchive X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 21:34:21 -0000 Author: delphij Date: Thu May 14 21:34:20 2015 New Revision: 282928 URL: https://svnweb.freebsd.org/changeset/base/282928 Log: Apply upstream changeset e6c9668: Add a check to archive_read_filter_consume to reject any attempts to move the file pointer by a negative amount. Note: Either this or commit 3865cf2 provides a fix for Issue 394. Modified: vendor/libarchive/dist/libarchive/archive_read.c Modified: vendor/libarchive/dist/libarchive/archive_read.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read.c Thu May 14 21:33:33 2015 (r282927) +++ vendor/libarchive/dist/libarchive/archive_read.c Thu May 14 21:34:20 2015 (r282928) @@ -1394,6 +1394,8 @@ __archive_read_filter_consume(struct arc { int64_t skipped; + if (request < 0) + return ARCHIVE_FATAL; if (request == 0) return 0; From owner-svn-src-vendor@FreeBSD.ORG Thu May 14 21:39:04 2015 Return-Path: Delivered-To: svn-src-vendor@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 9B17E71F; Thu, 14 May 2015 21:39:04 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8A4CF1722; Thu, 14 May 2015 21:39:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4ELd4gt069098; Thu, 14 May 2015 21:39:04 GMT (envelope-from delphij@FreeBSD.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4ELd4hf069097; Thu, 14 May 2015 21:39:04 GMT (envelope-from delphij@FreeBSD.org) Message-Id: <201505142139.t4ELd4hf069097@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: delphij set sender to delphij@FreeBSD.org using -f From: Xin LI Date: Thu, 14 May 2015 21:39:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r282930 - vendor/libarchive/dist/libarchive X-SVN-Group: vendor MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-vendor@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the vendor work area tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 May 2015 21:39:04 -0000 Author: delphij Date: Thu May 14 21:39:03 2015 New Revision: 282930 URL: https://svnweb.freebsd.org/changeset/base/282930 Log: Apply upstream changeset 24f5de6: Set a proper error message if we hit end-of-file when trying to read a cpio header. Suggested by Issue #395, although the actual problem there seems to have been the same as Issue #394. Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Modified: vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c ============================================================================== --- vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:35:45 2015 (r282929) +++ vendor/libarchive/dist/libarchive/archive_read_support_format_cpio.c Thu May 14 21:39:03 2015 (r282930) @@ -864,8 +864,11 @@ header_bin_le(struct archive_read *a, st /* Read fixed-size portion of header. */ h = __archive_read_ahead(a, bin_header_size, NULL); - if (h == NULL) + if (h == NULL) { + archive_set_error(&a->archive, 0, + "End of file trying to read next cpio header"); return (ARCHIVE_FATAL); + } /* Parse out binary fields. */ header = (const unsigned char *)h; @@ -900,8 +903,11 @@ header_bin_be(struct archive_read *a, st /* Read fixed-size portion of header. */ h = __archive_read_ahead(a, bin_header_size, NULL); - if (h == NULL) + if (h == NULL) { + archive_set_error(&a->archive, 0, + "End of file trying to read next cpio header"); return (ARCHIVE_FATAL); + } /* Parse out binary fields. */ header = (const unsigned char *)h;