Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Jan 1999 20:21:57 +0900
From:      "Daniel C. Sobral" <dcs@newsguy.com>
To:        Joe Abley <jabley@clear.co.nz>
Cc:        freebsd-hackers@FreeBSD.ORG, Mike Smith <mike@smith.net.au>
Subject:   Re: FICL and setting BTX variables
Message-ID:  <3699DED5.A622C57E@newsguy.com>
References:  <369929B0.7ACC2DED@newsguy.com> <199901110657.WAA87130@dingo.cdrom.com> <19990111210558.A29444@clear.co.nz>

next in thread | previous in thread | raw e-mail | index | archive | help
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? <wakes up at mention of awk>
> 
> 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



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