From owner-p4-projects@FreeBSD.ORG Thu Nov 8 01:09:59 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 3C46616A46E; Thu, 8 Nov 2007 01:09:59 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C521216A41A for ; Thu, 8 Nov 2007 01:09:58 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe10.tele2.se [212.247.155.33]) by mx1.freebsd.org (Postfix) with ESMTP id 2EC4513C4C5 for ; Thu, 8 Nov 2007 01:09:57 +0000 (UTC) (envelope-from hselasky@c2i.net) X-Cloudmark-Score: 0.000000 [] Received: from [85.19.218.45] (account mc467741@c2i.net [85.19.218.45] verified) by mailfe10.swip.net (CommuniGate Pro SMTP 5.1.13) with ESMTPA id 510221300 for perforce@freebsd.org; Thu, 08 Nov 2007 01:09:36 +0100 From: Hans Petter Selasky To: Perforce Change Reviews Date: Thu, 8 Nov 2007 01:10:09 +0100 User-Agent: KMail/1.9.7 References: <200711080007.lA8078QD059198@repoman.freebsd.org> In-Reply-To: <200711080007.lA8078QD059198@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_iPlMHLc56jZWWCA" Message-Id: <200711080110.10220.hselasky@c2i.net> Cc: Subject: Re: PERFORCE change 128799 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Nov 2007 01:09:59 -0000 --Boundary-00=_iPlMHLc56jZWWCA Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline FYI. My indent.diff is attached. --HPS On Thursday 08 November 2007, Hans Petter Selasky wrote: > http://perforce.freebsd.org/chv.cgi?CH=128799 > > Change 128799 by hselasky@hselasky_laptop001 on 2007/11/08 00:06:35 > > > Put the USB style script into the P4 tree. > > Affected files ... > > .. //depot/projects/usb/src/sys/dev/usb/usb_style.sh#1 add > > Differences ... --Boundary-00=_iPlMHLc56jZWWCA Content-Type: text/x-diff; charset="iso-8859-1"; name="indent.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="indent.diff" diff -u -r indent.orig/args.c indent/args.c --- indent.orig/args.c Mon Nov 5 21:43:24 2007 +++ indent/args.c Mon Nov 5 22:16:48 2007 @@ -157,6 +157,7 @@ {"sc", PRO_BOOL, true, ON, &star_comment_cont}, {"sob", PRO_BOOL, false, ON, &swallow_optional_blanklines}, {"st", PRO_SPECIAL, 0, STDIN, 0}, + {"ta", PRO_BOOL, false, ON, &auto_typedefs}, {"troff", PRO_BOOL, false, ON, &troff}, {"ut", PRO_BOOL, true, ON, &use_tabs}, {"v", PRO_BOOL, false, ON, &verbose}, diff -u -r indent.orig/indent.1 indent/indent.1 --- indent.orig/indent.1 Mon Nov 5 21:43:24 2007 +++ indent/indent.1 Mon Nov 5 22:12:19 2007 @@ -80,6 +80,7 @@ .Op Fl sob | Fl nsob .Ek .Op Fl \&st +.Op Fl \&ta .Op Fl troff .Op Fl ut | Fl nut .Op Fl v | Fl \&nv @@ -377,6 +378,9 @@ Causes .Nm to take its input from stdin and put its output to stdout. +.It Fl ta +Automatically add all identifiers ending in "_t" or "_T" to the list +of type keywords. .It Fl T Ns Ar typename Adds .Ar typename diff -u -r indent.orig/indent_globs.h indent/indent_globs.h --- indent.orig/indent_globs.h Mon Nov 5 21:43:24 2007 +++ indent/indent_globs.h Mon Nov 5 22:11:28 2007 @@ -204,6 +204,8 @@ * brace onto separate lines */ int use_tabs; /* set true to use tabs for spacing, * false uses all spaces */ +int auto_typedefs; /* set true to recognize identifiers + * ending in "_t" like typedefs */ /* -troff font state information */ diff -u -r indent.orig/lexi.c indent/lexi.c --- indent.orig/lexi.c Mon Nov 5 21:43:24 2007 +++ indent/lexi.c Mon Nov 5 22:21:47 2007 @@ -249,6 +249,17 @@ last_code = ident; /* Remember that this is the code we will * return */ + if (auto_typedefs) { + const char *q = s_token; + /* Check if we have an "_t" in the end */ + if (q[0] && q[1] && + (strcmp(q + strlen(q) - 2, "_t") == 0)) { + ps.its_a_keyword = true; + ps.last_u_d = true; + goto found_auto_typedef; + } + } + /* * This loop will check if the token is a keyword. */ @@ -285,6 +296,7 @@ /* FALLTHROUGH */ case 4: /* one of the declaration keywords */ + found_auto_typedef: if (ps.p_l_follow) { ps.cast_mask |= (1 << ps.p_l_follow) & ~ps.sizeof_mask; break; /* inside parens: cast, param list or sizeof */ --Boundary-00=_iPlMHLc56jZWWCA--