From owner-freebsd-bugs Sat Oct 2 4:30:13 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 570411514F for ; Sat, 2 Oct 1999 04:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id EAA47061; Sat, 2 Oct 1999 04:30:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from noc.clix.net.nz (noc.clix.net.nz [203.167.224.28]) by hub.freebsd.org (Postfix) with ESMTP id EB5E31514F for ; Sat, 2 Oct 1999 04:27:47 -0700 (PDT) (envelope-from jabley@noc.clix.net.nz) Received: (from jabley@localhost) by noc.clix.net.nz (8.8.8/8.8.8) id XAA24441; Sat, 2 Oct 1999 23:27:46 +1200 (NZST) (envelope-from jabley) Message-Id: <199910021127.XAA24441@noc.clix.net.nz> Date: Sat, 2 Oct 1999 23:27:46 +1200 (NZST) From: Joe Abley Reply-To: jabley@patho.gen.nz To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: kern/14087: FICL/softcore.awk patch Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 14087 >Category: kern >Synopsis: update sys/boot/ficl/softwords/softcore.awk >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Oct 2 04:30:00 PDT 1999 >Closed-Date: >Last-Modified: >Originator: Joe Abley >Release: current >Organization: Global Domination Inc >Environment: N/A >Description: Update sys/boot/ficl/softwords/softcore.awk in the tree to include some space optimisation in the ficl keywords stored in the giant C string softWords[]. Optimisation rules tested to exactly match output of new softcore.pl supplied by dcs for test data cat /sys/boot/ficl/softwords/*.fr >How-To-Repeat: N/A >Fix: Apply the following patch. If symptoms persist, consult a specialist. *** softcore.awk.orig Sat Oct 2 23:19:48 1999 --- softcore.awk Sat Oct 2 23:18:52 1999 *************** *** 1,6 **** --- 1,15 ---- #!/usr/bin/awk -f + # # Convert forth source files to a giant C string + # # Joe Abley , 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: src/sys/boot/ficl/softwords/softcore.awk,v 1.3 1999/09/29 10:58:43 dcs Exp $ BEGIN \ *************** *** 19,60 **** printf "** Created automagically by ficl/softwords/softcore.awk\n"; printf "*/\n\n"; printf "#include \"ficl.h\"\n\n"; ! printf "static char 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:]]\*\*/ && (commenting == 0) \ { ! sub("^\\\\[[:space:]]", ""); ! printf "/*\n%s\n", $0; commenting = 1; next; } ! /^\\[[:space:]]\*\*/ \ { - sub("^\\\\[[:space:]]", ""); - printf "%s\n", $0; next; } ! # if we are in a comment, then close it now (actual meat for this ! # input line processed in later predicates) (commenting != 0) \ { commenting = 0; --- 28,64 ---- printf "** Created automagically by ficl/softwords/softcore.awk\n"; printf "*/\n\n"; printf "#include \"ficl.h\"\n\n"; ! printf "static char softWords[] = \n"; commenting = 0; } # some general early substitutions { ! gsub(/\t/, " "); # replace each tab with 4 spaces ! gsub(/\"/, "\\\""); # escape quotes ! gsub(/\\[[:space:]]+$/, ""); # toss empty comments } # 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; } ! # if we have previously been processing a multi-line comment, then ! # close the comment now (since this line isn't part of a multi-line ! # comment) (commenting != 0) \ { commenting = 0; *************** *** 65,110 **** # (supports single-line directives only) /^\\[[:space:]]#/ \ { ! sub("^\\\\[[:space:]]", ""); printf "%s\n", $0; next; } ! # toss all other comments /^[[:space:]]*\\/ \ { next; } ! # lop off trailing comments /\\[[:space:]]+/ \ { ! sub("\\\\[[:space:]]+.*$", ""); } ! # delete ( ) comments ! /[[:space:]]+\([[:space:]].*\)/ \ { ! gsub("[[:space:]]+\([[:space:]].*\)", ""); } # remove leading spaces /^[[:space:]]+/ \ { ! sub("^[[:space:]]+", ""); } # removing trailing spaces /[[:space:]]+$/ \ { ! sub("[[:space:]]+$", ""); } # emit all other lines as quoted string fragments { ! sub("\\\\[[:space:]]+.*$", ""); # lop off trailing \ comments ! sub("[[:space:]]+$", ""); # remove trailing spaces ! printf " \"%s\"\n", $0; next; } --- 69,118 ---- # (supports single-line directives only) /^\\[[:space:]]#/ \ { ! sub(/^\\[[:space:]]/, ""); printf "%s\n", $0; next; } ! # toss all other full-line \ comments /^[[:space:]]*\\/ \ { next; } ! # lop off trailing \ comments /\\[[:space:]]+/ \ { ! sub(/\\[[:space:]]+.*$/, ""); } ! # expunge ( ) comments ! /[[:space:]]+\([[:space:]][^\)]*\)/ \ { ! gsub(/[[: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:]]*$/ \ ! { ! next; } # emit all other lines as quoted string fragments { ! printf " \"%s \"\n", $0; next; } >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message