doxygen.sed revision 10915
12SN/A#!/bin/sed -f
21762SN/A#
32SN/A# Copyright (c) 2014-2015 ARM Limited
42SN/A# All rights reserved
52SN/A#
62SN/A# Licensed under the Apache License, Version 2.0 (the "License");
72SN/A# you may not use this file except in compliance with the License.
82SN/A# You may obtain a copy of the License at
92SN/A#
102SN/A#     http://www.apache.org/licenses/LICENSE-2.0
112SN/A#
122SN/A# Unless required by applicable law or agreed to in writing, software
132SN/A# distributed under the License is distributed on an "AS IS" BASIS,
142SN/A# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
152SN/A# See the License for the specific language governing permissions and
162SN/A# limitations under the License.
172SN/A#
182SN/A# Authors: Andreas Sandberg
192SN/A
202SN/A# READ BEFORE EDITING:
212SN/A#
222SN/A# * Avoid adding or removing newlines (e.g., deleting matched lines). It's
232SN/A#   much easier to understand the Doxygen logs if they point to the right
242SN/A#   line in the source files.
252SN/A#
262SN/A# * SED can be hard to read, so please document what your replacement rules
272665Ssaidi@eecs.umich.edu#   are supposed to do and why.
282665Ssaidi@eecs.umich.edu#
292SN/A
302SN/A# Handle TODO/FIXME/BUG comments
312439SN/A/\/\/ \(TODO\|FIXME\|BUG\):/ {
322984Sgblack@eecs.umich.edu    # Transform the first line of the comment block into a Doxygen C++ comment.
33146SN/A    s/\([^\]\)\/\/ /\1\/\/\/ /;
34146SN/A
35146SN/A    : todo_comment_cont
36146SN/A    # Replace any TODO/FIXME/BUG commands with Doxygen equivalents
37146SN/A    s/\(TODO\|FIXME\):/@todo /;
38146SN/A    s/\(BUG\):/@bug /;
391717SN/A    # Get the next line
40146SN/A    n;
411717SN/A    # If this line is only contains whitespace and a comment, it is a
42146SN/A    # conntinuation of the previous line. If so, make it a Doxygen comment.
431977SN/A    s/\([:space:]*\)\/\/\([^\/]\)/\1\/\/\/\2/ ;
442623SN/A    # Try to match another line if the previous s command matched a line.
452683Sktlim@umich.edu    t todo_comment_cont;
461717SN/A}
47146SN/A