From owner-freebsd-hackers Mon Jan 11 04:12:30 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id EAA24373 for freebsd-hackers-outgoing; Mon, 11 Jan 1999 04:12:30 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id EAA24368 for ; Mon, 11 Jan 1999 04:12:28 -0800 (PST) (envelope-from dcs@newsguy.com) Received: from newsguy.com by peach.ocn.ne.jp (8.9.1a/OCN) id VAA10941; Mon, 11 Jan 1999 21:11:39 +0900 (JST) Message-ID: <3699DED5.A622C57E@newsguy.com> Date: Mon, 11 Jan 1999 20:21:57 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.5 [en] (Win98; I) X-Accept-Language: pt-BR,ja MIME-Version: 1.0 To: Joe Abley CC: freebsd-hackers@FreeBSD.ORG, Mike Smith Subject: Re: FICL and setting BTX variables References: <369929B0.7ACC2DED@newsguy.com> <199901110657.WAA87130@dingo.cdrom.com> <19990111210558.A29444@clear.co.nz> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Joe Abley wrote: > > > I'm not sure about the whole softwords/help text munging thing. Using > > Perl scripts is bad for various reasons, but I'm not sure that I want > > to go to having committed generated files (like the kernel uses) or the > > other way to compiled special-purpose tools. Anyone handy with awk > > want to try fixing these - both would probably succumb to the awesome > > power of awk. > > Eh? > > If someone needs some awk writing, and can describe clearly what needs > doing, I'll do it. Roger. I thought the problem could be easily solved by awk, but I do not qualify as "handy with awk" by any standards. :-) I don't know what are the perl scripts making the help file, so I'll describe just the script I converted. It is /sys/boot/ficl/softwords/softcore.pl. It basic function is dealing with assorted variations of this basic regexp pattern: ".*\\ .*" (the \\ is an escaped backslash, not two of them). We process three variations of this pattern. 1) If the pattern is "^\\ \*\*" (^ meaning it is at the beginning of the line), translate the bugger into a C comment. The translation should spam multiple lines and look like this: \ ** This is \ ** an example \ ** of this pattern becomes /* This is * an example * of this pattern */ 2) If the pattern is "^\\ #", you just cut out "\\ ". Example: \ #ifdef LOCAL_WORDSET becomes #ifdef LOCAL_WORDSET 3) If the pattern is "^\\ .*" or " \\ .*", then cut it out. Example: : definition \ This is a comment becomes : definition All these patterns apply to everything up to the end of the line. Empty lines and lines that become empty after the rule number 3 was applied must be ignored. Aside from that, cut trailing spaces if the line has more than one. You can run the perl script in /sys/boot/ficl/softwords against the .fr files in that directory, to compare your results against the original program. But, mind you, we'll be asking you to remove the following pattern later: " ( [^)]*)" (not to the end of the line). (This has been asked, and ought to work, but I'd prefer having a perfect translation of the perl script in the repository first.) -- Daniel C. Sobral (8-DCS) dcs@newsguy.com If you sell your soul to the Devil and all you get is an MCSE from it, you haven't gotten market rate. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message