Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2015 15:35:56 GMT
From:      clord@FreeBSD.org
To:        svn-soc-all@FreeBSD.org
Subject:   socsvn commit: r287478 - soc2015/clord/head/sys/contrib/ficl/softwords
Message-ID:  <201506231535.t5NFZuo7049950@socsvn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: clord
Date: Tue Jun 23 15:35:55 2015
New Revision: 287478
URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=287478

Log:
  Add more FreeBSD customizations back into vendor code

Added:
  soc2015/clord/head/sys/contrib/ficl/softwords/freebsd.fr
     - copied unchanged from r287241, soc2015/clord/head/sys/boot/ficl/softwords/freebsd.fr
  soc2015/clord/head/sys/contrib/ficl/softwords/softcore.awk
     - copied unchanged from r287241, soc2015/clord/head/sys/boot/ficl/softwords/softcore.awk

Copied: soc2015/clord/head/sys/contrib/ficl/softwords/freebsd.fr (from r287241, soc2015/clord/head/sys/boot/ficl/softwords/freebsd.fr)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2015/clord/head/sys/contrib/ficl/softwords/freebsd.fr	Tue Jun 23 15:35:55 2015	(r287478, copy of r287241, soc2015/clord/head/sys/boot/ficl/softwords/freebsd.fr)
@@ -0,0 +1,36 @@
+\ ** Copyright (c) 1998 Daniel C. Sobral <dcs@freebsd.org>
+\ ** All rights reserved.
+\ **
+\ ** 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.
+\ **
+\ ** $FreeBSD$
+
+\ Words for use in scripts:
+\ % ignore errors here
+\ $ echo this line
+
+: tib> source >in @ tuck over >in ! - >r + r> ;
+: % tib> ['] evaluate catch drop ;
+: $ tib> 2dup type cr evaluate ;
+
+\ ** E N D   F R E E B S D . F R
+

Copied: soc2015/clord/head/sys/contrib/ficl/softwords/softcore.awk (from r287241, soc2015/clord/head/sys/boot/ficl/softwords/softcore.awk)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ soc2015/clord/head/sys/contrib/ficl/softwords/softcore.awk	Tue Jun 23 15:35:55 2015	(r287478, copy of r287241, soc2015/clord/head/sys/boot/ficl/softwords/softcore.awk)
@@ -0,0 +1,183 @@
+#!/usr/bin/awk -f
+#
+# Convert forth source files to a giant C string
+#
+# Joe Abley <jabley@patho.gen.nz>, 12 January 1999
+#
+# 02-oct-1999:  Cleaned up awk slightly; added some additional logic
+#               suggested by dcs to compress the stored forth program.
+#
+# Note! This script uses strftime() which is a gawk-ism, and the
+# POSIX [[:space:]] character class.
+#
+# $FreeBSD$
+
+BEGIN \
+{
+  printf "/*******************************************************************\n";
+  printf "** s o f t c o r e . c\n";
+  printf "** Forth Inspired Command Language -\n";
+  printf "** Words from CORE set written in FICL\n";
+  printf "** Author: John Sadler (john_sadler@alum.mit.edu)\n";
+  printf "** Created: 27 December 1997\n";
+  printf "** Last update: %s\n", datestamp;
+  printf "*******************************************************************/\n";
+  printf "/*\n";
+  printf "** DO NOT EDIT THIS FILE -- it is generated by softwords/softcore.awk\n";
+  printf "** Make changes to the .fr files in ficl/softwords instead.\n";
+  printf "** This file contains definitions that are compiled into the\n";
+  printf "** system dictionary by the first virtual machine to be created.\n";
+  printf "** Created automagically by ficl/softwords/softcore.awk\n";
+  printf "*/\n";
+  printf "/*\n";
+  printf "** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)\n";
+  printf "** All rights reserved.\n";
+  printf "**\n";
+  printf "** Get the latest Ficl release at http://ficl.sourceforge.net\n";
+  printf "**\n";
+  printf "** I am interested in hearing from anyone who uses ficl. If you have\n";
+  printf "** a problem, a success story, a defect, an enhancement request, or\n";
+  printf "** if you would like to contribute to the ficl release, please send\n";
+  printf "** contact me by email at the address above.\n";
+  printf "**\n";
+  printf "** L I C E N S E  and  D I S C L A I M E R\n";
+  printf "** \n";
+  printf "** Redistribution and use in source and binary forms, with or without\n";
+  printf "** modification, are permitted provided that the following conditions\n";
+  printf "** are met:\n";
+  printf "** 1. Redistributions of source code must retain the above copyright\n";
+  printf "**    notice, this list of conditions and the following disclaimer.\n";
+  printf "** 2. Redistributions in binary form must reproduce the above copyright\n";
+  printf "**    notice, this list of conditions and the following disclaimer in the\n";
+  printf "**    documentation and/or other materials provided with the distribution.\n";
+  printf "**\n";
+  printf "** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n";
+  printf "** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n";
+  printf "** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n";
+  printf "** ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n";
+  printf "** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n";
+  printf "** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n";
+  printf "** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n";
+  printf "** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n";
+  printf "** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n";
+  printf "** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n";
+  printf "** SUCH DAMAGE.\n";
+  printf "*/\n";
+  printf "\n";
+  printf "\n#include \"ficl.h\"\n";
+  printf "\nstatic char softWords[] =\n";
+  printf "#if FICL_WANT_SOFTWORDS\n";
+
+  commenting = 0;
+}
+
+# some general early substitutions
+{
+  gsub(/\t/, "    ");			# replace each tab with 4 spaces
+  gsub(/\"/, "\\\"");			# escape quotes
+  gsub(/\\[[:space:]]+$/, "");		# toss empty comments
+}
+
+# strip out empty lines
+/^ *$/ \
+{
+  next;
+}
+
+# emit / ** lines as multi-line C comments
+/^\\[[:space:]]\*\*/ \
+{
+  sub(/^\\[[:space:]]/, "");
+  if (commenting == 0) printf "/*\n";
+  printf "%s\n", $0;
+  commenting = 1;
+  next;
+}
+
+# strip blank lines
+/^[[:space:]]*$/ \
+{
+  next;
+}
+
+# function to close a comment, used later
+function end_comments()
+{
+  commenting = 0;
+  printf "*/\n";
+}
+
+# pass commented preprocessor directives
+/^\\[[:space:]]#/ \
+{
+  if (commenting) end_comments();
+  sub(/^\\[[:space:]]/, "");
+  printf "%s\n", $0;
+  next;
+}
+
+# toss all other full-line \ comments
+/^\\/ \
+{
+  if (commenting) end_comments();
+  next;
+}
+
+# lop off trailing \ comments
+/\\[[:space:]]+/ \
+{
+  sub(/\\[[:space:]]+.*$/, "");
+}
+
+# expunge ( ) comments
+/[[:space:]]+\([[:space:]][^)]*\)/ \
+{
+  sub(/[[:space:]]+\([[:space:]][^)]*\)/, "");
+}
+
+# remove leading spaces
+/^[[:space:]]+/ \
+{
+  sub(/^[[:space:]]+/, "");
+}
+
+# removing trailing spaces
+/[[:space:]]+$/ \
+{
+  sub(/[[:space:]]+$/, "");
+}
+
+# strip out empty lines again (preceding rules may have generated some)
+/^[[:space:]]*$/ \
+{
+  if (commenting) end_comments();
+  next;
+}
+
+# emit all other lines as quoted string fragments
+{
+  if (commenting) end_comments();
+
+  printf "    \"%s \"\n", $0;
+  next;
+}
+
+END \
+{
+  if (commenting) end_comments();
+  printf "#endif /* WANT_SOFTWORDS */\n";
+  printf "    \"quit \";\n";
+  printf "\n\nvoid ficlCompileSoftCore(FICL_SYSTEM *pSys)\n";
+  printf "{\n";
+  printf "    FICL_VM *pVM = pSys->vmList;\n";
+  printf "    CELL id = pVM->sourceID;\n";
+  printf "    int ret = sizeof (softWords);\n";
+  printf "	  assert(pVM);\n";
+  printf "    pVM->sourceID.i = -1;\n";
+  printf "    ret = ficlExec(pVM, softWords);\n";
+  printf "    pVM->sourceID = id;\n";
+  printf "    if (ret == VM_ERREXIT)\n";
+  printf "        assert(FALSE);\n";
+  printf "    return;\n";
+  printf "}\n";
+}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201506231535.t5NFZuo7049950>