Date: Thu, 21 Dec 2000 10:29:53 +1100 From: Peter Jeremy <peter.jeremy@alcatel.com.au> To: Marcel Moolenaar <marcel@cup.hp.com> Cc: arch@FreeBSD.ORG Subject: Re: gensetdefs using sh(1),sed(1),grep(1) and awk(1) Message-ID: <20001221102952.O54775@gsmx07.alcatel.com.au> In-Reply-To: <3A405A43.5C10697C@cup.hp.com>; from marcel@cup.hp.com on Tue, Dec 19, 2000 at 11:05:39PM -0800 References: <3A405A43.5C10697C@cup.hp.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 2000-Dec-19 23:05:39 -0800, Marcel Moolenaar <marcel@cup.hp.com> wrote: >Read and weep :-) I'll go on record as thinking the perl version is more legible and more maintainable. The base system includes a number of Turing-equivalent languages: [c]sh builtins, awk, perl, C, C++, FORTH (if you include the loader), groff and (I believe) sed. gensetdefs could be written in any of these languages. If someone really wants to minimise the number of build tools, they are free to write gensetdefs using sh builtins only. One reason why the base system includes some many functionally equivalent tools is that they are targeted for different purposes. Rather than the adopt a one tool suits all purposes, I believe it's worthwhile looking at the requirements and then selecting the most appropriate tool. In this case, the need for getsetdefs to be MI whilst processing MD objects suggests that using objdump is better than directly reading the raw objects. Given the speed of both scripted versions, there isn't any need to go to a compiled language for performance reasons. Since this tool is primarily text processing, awk or perl are probably better choices than C. >I think it can do better if we can avoid the "system()" calls... The fgrep, both sed's and the sort could be done trivially in awk. Handling the "2**N" output could be done with a simple expression parser. Getting rid of the system("echo | dc") would be the hardest bit - but still isn't that difficult. Peter To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20001221102952.O54775>