Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site fortune.UUCP Path: utzoo!linus!vaxine!wjh12!genrad!mit-eddie!mit-vax!eagle!mhuxl!ihnp4!fortune!rpw3 From: rpw3@fortune.UUCP Newsgroups: net.unix Subject: Re: Re: 'exit(1);' considered useless; p - (nf) Message-ID: <2534@fortune.UUCP> Date: Tue, 14-Feb-84 04:13:33 EST Article-I.D.: fortune.2534 Posted: Tue Feb 14 04:13:33 1984 Date-Received: Wed, 15-Feb-84 06:16:20 EST Sender: notes@fortune.UUCP Organization: Fortune Systems, Redwood City, CA Lines: 39 #R:utah-gr:-107700:fortune:26900025:000:1602 fortune!rpw3 Feb 13 21:01:00 1984 [ Please note that only worthy ideas are worthy of satire... -rpw3] Why not generalize your generalized "%p" format one better? :-) Make ALL the formats be routines, called through PrintfFormatTable["z"-"a"+1]. Let all the "standard" routines ("%d" = decimal, etc.) have their addresses loaded into PrintfFormatTable (which must be in read/write memory) at load time, but allow the programmer to load his/her own fave rave routines over that.(So if I want a "%j" to call routine "frazzle", somewhere early in "main()" say extern PrintfFormatTable[], frazzle(); ... PrintfFormatTable["j"-"a"] := frazzle; ... and from then on, voila!, 'printf("...%j...",arg)' will call "frazzle" with the argument convention exactly as shown in the preceding article. Since one of the flags to "frazzle" will be whether it was called as "%j" or "%J", PrintfFormatTable need only be 26 entries (saving space). In fact, this idea may be implemented WITHOUT changing the binaries of "stdio", since all we have to do is create the user routine "pRintf" (big-R'ted printf) which handles PrintfFormatTable completely invisibly to "printf", which is called as needed to print individual argument types. Of course, "pRintf" should default most of the standard formats to calling "printf", unless superseded in PrintfFormatTable. The only drawback I see is changing all the printf's in all our programs to pRintf's, but what are editors for? Rob Warnock UUCP: {sri-unix,amd70,hpda,harpo,ihnp4,allegra}!fortune!rpw3 DDD: (415)595-8444 USPS: Fortune Systems Corp, 101 Twin Dolphins Drive, Redwood City, CA 94065