1
0
Fork 0
forked from nuttx/nuttx-update

tools/astyle.sh: Formatting tool based on logic from Lorenz Meier

This commit is contained in:
Gregory Nutt 2014-03-26 08:50:48 -06:00
parent 8fb610a537
commit f6dedaee30
6 changed files with 56 additions and 1 deletions

View file

@ -7044,4 +7044,6 @@
the task that started in (other than knowing it as the parent). This
allows me to remove so kludge logic to "deparent" the pthread on
startup (2014-3-25).
* tools/astyle.sh: A code formatting tool from Lorenz Meier. This
tool should do a better job than the old tools/indent.sh tool.

View file

@ -3082,6 +3082,7 @@ static int sam_ep_submit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
epno = USB_EPNO(ep->eplog);
req->result = -EINPROGRESS;
req->xfrd = 0;
privreq->inflight = 0;
flags = irqsave();
/* Handle IN (device-to-host) requests. NOTE: If the class device is

View file

@ -3575,6 +3575,7 @@ static int sam_ep_submit(struct usbdev_ep_s *ep, struct usbdev_req_s *req)
epno = USB_EPNO(ep->eplog);
req->result = -EINPROGRESS;
req->xfrd = 0;
privreq->inflight = 0;
flags = irqsave();
/* Handle IN (device-to-host) requests. NOTE: If the class device is

View file

@ -12,6 +12,12 @@ README.txt
This file!
astyle.sh
---------
A C formatting tool from Lorenz Meier. This is based on astyle and gets
very close to the NuttX coding style.
Config.mk
---------
@ -528,6 +534,8 @@ indent.sh
to my coding NuttX coding style. It doesn't do a really good job,
however (see the comments at the top of the indent.sh file).
See astyle.sh above. I suspect that it will do a better job.
zipme.sh
--------

43
tools/astyle.sh Executable file
View file

@ -0,0 +1,43 @@
#!/bin/sh
############################################################################
# tools/astyle.sh
#
# Copyright (C) 2014 Gregory Nutt. All rights reserved.
# Author: Lorenz Meier
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name NuttX nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
astyle \
--style=gnu \
--indent=spaces=2 \
--indent-cases \
--indent-switches \
$*

View file

@ -41,7 +41,7 @@
# - I usually align things vertically (like '=' in assignments),
# - indent puts a bogus blank line at the top of the file,
# - I don't like the way it handles nested conditional compilation intermixed with code.
# - I also indent brackets differently on structures than does not script.
# - I also indent brackets differently on structures than does this script.
#
# Constants