From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "ozan s. yigit" Message-ID: <4da3d9af.0203111002.2078a2a2@posting.google.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit References: <5194db69d6a2bcb77be8696538794a50@plan9.bell-labs.com>, <3.0.6.32.20020311101349.00998010@pop3.clear.net.nz> Subject: Re: [9fans] samuel Date: Mon, 11 Mar 2002 18:06:19 +0000 Topicbox-Message-UUID: 64cb26e0-eaca-11e9-9e20-41e7f4b1d025 Andrew Simmons: > ... I'd just like some way to find function definitions without > changing the way I lay them out. grep ^nurdge *.c does have the appeal of > simplicity, but I don't like adjusting my style to suit the machine. it is not hard to write an ad-hoc scanner/parser to look for right sorts of things and capture what you want. i once wrote a tool that finds anything that looks like a function call in c-like programs. it knows how to skip comments, and how to collect the arguments (string or otherwise in multiple lines) after an identifier and an opening paren, with proper number of closing parens: csee -e 'draw$' frdelete.c .. draw(f->b, Rect(pt0.x, pt0.y, pt0.x+(f->r.max.x-pt1.x), q0), f->b, nil, pt1) draw(f->b, Rect(f->r.min.x, q0, f->r.max.x, q0+(q2-q1)), f->b, nil, Pt(f->r.min.x, q1)) whereas unaided grep 'draw' will only get you draw(f->b, Rect(pt0.x, pt0.y, pt0.x+(f->r.max.x-pt1.x), q0), draw(f->b, Rect(f->r.min.x, q0, f->r.max.x, q0+(q2-q1)), this was handy in finding functions regardless of how they were laid out instead of just bits and pieces. oz --- computing is cognitively constrained. -- peter roosen-runge