Date: Sun, 9 Jun 1996 21:25:11 GMT From: James Raynard <fqueries@jraynard.demon.co.uk> To: jmb@freefall.freebsd.org Cc: jbarrm@panix.com, questions@freebsd.org Subject: Re: Design & Implementation of 4.4BSD Message-ID: <199606092125.VAA04908@jraynard.demon.co.uk> In-Reply-To: <199606091250.FAA03535@freefall.freebsd.org> (jmb@freefall.freebsd.org)
next in thread | previous in thread | raw e-mail | index | archive | help
>>>>> "Jonathan M. Bresler" <jmb@freefall.freebsd.org> writes: > > Barry Masterson wrote: > > > > Hi, > > > > I'm working my way thru the recently released book entitled > > "The Design and Implementation of the 4.4BSD Operating System", > > and have come across some algorithm code samples on pages 199 & 203: > > > > disksort(dq, bp) > > drive queue *dq; > > buffer *bp; > > { > > if (drive queue is empty) { > > place the buffer at the front of the drive queue; > > return; > > } > > if (request lies before the first active request) { > > locate the beginning of the second request list; > > sort bp into the second request list; > > } else > > sort bp into the current request list; > > } > > > > I'm familiar with the basics of c/c++, perl, shell scripts, but this > > use of "the", "of", "into", "at" is something I've yet to see. It > > seems a little too human readable to be real code. > > > > What language is this? Are there other examples of this type of > > programming in the FreeBSD source code? > > its called "psuedo-code". rather then present the actual source > the authors are presenting the algorithm stripped of the details > of data structures and pointer (etc....) that obscure the purpose > of the code. rather liek the difference between the blueprints > and the building itself. It might also be worth mentioning that pseudo-code is very useful when writing code - first decide what the function is supposed to do, then write down pseudo-code that describes this in more detail, then write comments based on the pseudo-code. All you have to do then is fill in the gaps between the comments! 8-) > ps. this is one of the joys of FreeBSD--getting to see the real > code Absolutely! -- James Raynard, Edinburgh, Scotland | http://www.freebsd.org/~jraynard/ james@jraynard.demon.co.uk | jraynard@freebsd.org
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606092125.VAA04908>