softcore.awk (85934) | softcore.awk (167850) |
---|---|
1#!/usr/bin/awk -f 2# 3# Convert forth source files to a giant C string 4# 5# Joe Abley <jabley@patho.gen.nz>, 12 January 1999 6# 7# 02-oct-1999: Cleaned up awk slightly; added some additional logic 8# suggested by dcs to compress the stored forth program. 9# 10# Note! This script uses strftime() which is a gawk-ism, and the 11# POSIX [[:space:]] character class. 12# | 1#!/usr/bin/awk -f 2# 3# Convert forth source files to a giant C string 4# 5# Joe Abley <jabley@patho.gen.nz>, 12 January 1999 6# 7# 02-oct-1999: Cleaned up awk slightly; added some additional logic 8# suggested by dcs to compress the stored forth program. 9# 10# Note! This script uses strftime() which is a gawk-ism, and the 11# POSIX [[:space:]] character class. 12# |
13# $FreeBSD: head/sys/boot/ficl/softwords/softcore.awk 85934 2001-11-03 01:33:12Z obrien $ | 13# $FreeBSD: head/sys/boot/ficl/softwords/softcore.awk 167850 2007-03-23 22:26:01Z jkim $ |
14 15BEGIN \ 16{ | 14 15BEGIN \ 16{ |
17 printf "/***************************************************************\n"; | 17 printf "/*******************************************************************\n"; |
18 printf "** s o f t c o r e . c\n"; 19 printf "** Forth Inspired Command Language -\n"; 20 printf "** Words from CORE set written in FICL\n"; 21 printf "** Author: John Sadler (john_sadler@alum.mit.edu)\n"; 22 printf "** Created: 27 December 1997\n"; 23 printf "** Last update: %s\n", datestamp; | 18 printf "** s o f t c o r e . c\n"; 19 printf "** Forth Inspired Command Language -\n"; 20 printf "** Words from CORE set written in FICL\n"; 21 printf "** Author: John Sadler (john_sadler@alum.mit.edu)\n"; 22 printf "** Created: 27 December 1997\n"; 23 printf "** Last update: %s\n", datestamp; |
24 printf "***************************************************************/\n"; 25 printf "\n/*\n"; | 24 printf "*******************************************************************/\n"; 25 printf "/*\n"; 26 printf "** DO NOT EDIT THIS FILE -- it is generated by softwords/softcore.awk\n"; 27 printf "** Make changes to the .fr files in ficl/softwords instead.\n"; |
26 printf "** This file contains definitions that are compiled into the\n"; 27 printf "** system dictionary by the first virtual machine to be created.\n"; 28 printf "** Created automagically by ficl/softwords/softcore.awk\n"; 29 printf "*/\n"; | 28 printf "** This file contains definitions that are compiled into the\n"; 29 printf "** system dictionary by the first virtual machine to be created.\n"; 30 printf "** Created automagically by ficl/softwords/softcore.awk\n"; 31 printf "*/\n"; |
32 printf "/*\n"; 33 printf "** Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)\n"; 34 printf "** All rights reserved.\n"; 35 printf "**\n"; 36 printf "** Get the latest Ficl release at http://ficl.sourceforge.net\n"; 37 printf "**\n"; 38 printf "** I am interested in hearing from anyone who uses ficl. If you have\n"; 39 printf "** a problem, a success story, a defect, an enhancement request, or\n"; 40 printf "** if you would like to contribute to the ficl release, please send\n"; 41 printf "** contact me by email at the address above.\n"; 42 printf "**\n"; 43 printf "** L I C E N S E and D I S C L A I M E R\n"; 44 printf "** \n"; 45 printf "** Redistribution and use in source and binary forms, with or without\n"; 46 printf "** modification, are permitted provided that the following conditions\n"; 47 printf "** are met:\n"; 48 printf "** 1. Redistributions of source code must retain the above copyright\n"; 49 printf "** notice, this list of conditions and the following disclaimer.\n"; 50 printf "** 2. Redistributions in binary form must reproduce the above copyright\n"; 51 printf "** notice, this list of conditions and the following disclaimer in the\n"; 52 printf "** documentation and/or other materials provided with the distribution.\n"; 53 printf "**\n"; 54 printf "** THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND\n"; 55 printf "** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n"; 56 printf "** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n"; 57 printf "** ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE\n"; 58 printf "** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n"; 59 printf "** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n"; 60 printf "** OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n"; 61 printf "** HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n"; 62 printf "** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n"; 63 printf "** OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n"; 64 printf "** SUCH DAMAGE.\n"; 65 printf "*/\n"; 66 printf "\n"; |
|
30 printf "\n#include \"ficl.h\"\n"; 31 printf "\nstatic char softWords[] =\n"; | 67 printf "\n#include \"ficl.h\"\n"; 68 printf "\nstatic char softWords[] =\n"; |
69 printf "#if FICL_WANT_SOFTWORDS\n"; |
|
32 33 commenting = 0; 34} 35 36# some general early substitutions 37{ 38 gsub(/\t/, " "); # replace each tab with 4 spaces 39 gsub(/\"/, "\\\""); # escape quotes --- 82 unchanged lines hidden (view full) --- 122 123 printf " \"%s \"\n", $0; 124 next; 125} 126 127END \ 128{ 129 if (commenting) end_comments(); | 70 71 commenting = 0; 72} 73 74# some general early substitutions 75{ 76 gsub(/\t/, " "); # replace each tab with 4 spaces 77 gsub(/\"/, "\\\""); # escape quotes --- 82 unchanged lines hidden (view full) --- 160 161 printf " \"%s \"\n", $0; 162 next; 163} 164 165END \ 166{ 167 if (commenting) end_comments(); |
168 printf "#endif /* WANT_SOFTWORDS */\n"; |
|
130 printf " \"quit \";\n"; 131 printf "\n\nvoid ficlCompileSoftCore(FICL_SYSTEM *pSys)\n"; 132 printf "{\n"; 133 printf " FICL_VM *pVM = pSys->vmList;\n"; | 169 printf " \"quit \";\n"; 170 printf "\n\nvoid ficlCompileSoftCore(FICL_SYSTEM *pSys)\n"; 171 printf "{\n"; 172 printf " FICL_VM *pVM = pSys->vmList;\n"; |
173 printf " CELL id = pVM->sourceID;\n"; |
|
134 printf " int ret = sizeof (softWords);\n"; 135 printf " assert(pVM);\n"; | 174 printf " int ret = sizeof (softWords);\n"; 175 printf " assert(pVM);\n"; |
136 printf "\n" | 176 printf " pVM->sourceID.i = -1;\n"; |
137 printf " ret = ficlExec(pVM, softWords);\n"; | 177 printf " ret = ficlExec(pVM, softWords);\n"; |
178 printf " pVM->sourceID = id;\n"; |
|
138 printf " if (ret == VM_ERREXIT)\n"; 139 printf " assert(FALSE);\n"; 140 printf " return;\n"; 141 printf "}\n"; 142} | 179 printf " if (ret == VM_ERREXIT)\n"; 180 printf " assert(FALSE);\n"; 181 printf " return;\n"; 182 printf "}\n"; 183} |