Path: utzoo!yunexus!geac!daveb From: daveb@geac.UUCP (David Collier-Brown) Newsgroups: comp.emacs Subject: Re: Hiding comments in C mode Summary: or you can change the problem... Keywords: web Message-ID: <2162@geac.UUCP> Date: 24 Jan 88 17:51:15 GMT Article-I.D.: geac.2162 Posted: Sun Jan 24 12:51:15 1988 References: <8801202039.AA09434@ucbvax.Berkeley.EDU> <296@dana.UUCP> Reply-To: daveb@geac.UUCP (David Collier-Brown) Organization: The G. Yac Co., Ltd. Lines: 53 Another way of "hiding" latge numbers of comments is to make them unnecessary: When I get a function that starts looking over-complex I re-write it in c-web, thereby reducing the need for putting the comments right in the code. For example, @*lsproj/lcproj -- list projects@> @*Identifying the Physical Directory to List@> .PP The first task is figuring out what to list. This is done by context, much as lc does. We wish to list the closest enclosing project if no directory or project is given and the rightmost project in the pathname if a pathname is given. .PP Regrettably, this is harder that it appears. .PP First, we go to the current project directory if we're in a subdirectory of it. This is to allow any parameters not beginning with "/" to be interpreted as relative to the current project, not just the current directory (which might not be a project directory). @= #include /* or string.h... Portability? faugh! */ @= extern char *getcwd(/* char * space, int size */), *strtok(/* char *source | NULL, char *seperators */); char *currentWorkingDirectory, *p, /* Pointer to current token. */ *currentProject; @= if ((currentWorkingDirectory = getcwd((char *)NULL,MAXLINE)) == NULL) { fprintf(stderr,"%s: Could not allocate enough memory to contain\n", ProgName); fprintf(stderr,"the name of the working directory.\n"); fprintf(stderr,"Halting"); exit(SYSTEM_ERROR); } /* Postcondition: a working directory's name was found. */ /* It may or may not exist, but we pretend it must. */ assert(*currentWorkingDirectory != NULL); -- David Collier-Brown. {mnetor yetti utgpu}!geac!daveb Geac Computers International Inc., | Computer Science loses its 350 Steelcase Road,Markham, Ontario, | memory (if not its mind) CANADA, L3R 1B3 (416) 475-0525 x3279 | every 6 months.