1 # :vim setet ts=4 sw=4:
2 #==================================================================================
3 # Copyright (c) 2020 Nokia
4 # Copyright (c) 2020 AT&T Intellectual Property.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #==================================================================================
19 # Mnemonic: scrape_types.sh
20 # Abstract: This parses the RIC_msg_types header file and geneates
21 # some doc. See the header file for a description of what
22 # is recognised by this parser.
24 # Author: E. Scott Daniels
25 # ----------------------------------------------------------------------------------
28 sdir="../../../docs" # dir where RTD scraper looks
29 input=../../../src/rmr/common/include/RIC_message_types.h
31 export XFM_OUTPUT_TYPE=rst # it should be this
37 -o) export XFM_OUTPUT_TYPE=$2
48 export OUTPUT_TYPE=$XFM_OUTPUT_TYPE # compat with project setup
52 .** This {X}fm source is generated by $0 in $PWD. Any edits
53 .** are very likely to be lost.
56 .dv doc_title RIC Message Types
61 sed 's/^ *//' $input | awk '
70 # starting with token stk, build remaining tokens into a record
71 function build_rec( stk ) {
73 for( ; stk <= NF; stk++ ) {
79 # ------------------------------------------------------------------------
81 snarf && /^$/ && space_ok {
82 printf( "&space\n\n" );
83 space_ok = 0 # eat multiple blank lines
99 printf( "&end_dlist\n" );
102 printf( "\n&h2(%s)\n", $0 )
108 snarf && $1 == "*/" {
115 if( $4 == "//--" ) { # ignored completely
120 printf( "\n&beg_dlist( 1.5i Helvetica-bold : : 30,70) \n" )
125 printf( "&di(%s) %s\n", $2, build_rec( 5 ) )
128 printf( "&di(%s) deprecated\n", $2 )
130 printf( "&di(%s) &break\n", $2 )
134 snarf = desc; # snarf next only if //+ is the first token
139 if( $1 == "//+" ) { # continued description, add it on
140 printf( "%s\n", build_rec( 5 ) )
154 printf( "&end_dlist\n" );
161 tfm $xsrc stdout | sed 's/^ //; s/ *$//' >$sdir/msg_types.$out_suffix