2 # Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
4 # Licensed under the OpenSSL license (the "License"). You may not use
5 # this file except in compliance with the License. You can obtain a copy
6 # in the file LICENSE in the source distribution or at
7 # https://www.openssl.org/source/license.html
22 $incomm++ while $tststr =~ /\/\*/g;
23 $incomm-- while $tststr =~ /\*\//g;
30 } elsif(/^ *\} [^\s]+(\[\d*\])* = \{/) {
33 $arrcnt++ while $tststr =~ /\[/g;
42 } elsif($in_su == 2) {
48 my @strucdata = structureData($data);
49 $out .= displayData($indent, 0, \@strucdata);
50 $out .= "\n$indent};\n";
54 } elsif($incomm <= 0 && /( *)(static )?(const )?(union|struct) ([a-zA-Z_\$][\$0-9a-zA-Z_]+ )?\{/) {
67 my @datalist = split(/(\{|\}|,|"|#|\n|\/\*|\*\/|\(|\))/, $data);
79 foreach $item (@datalist) {
84 push @struclist, $dataitem;
101 push @struclist, $dataitem;
113 $substruc = structureData($dataitem);
114 $dataitem = $substruc;
117 } elsif($item eq "{") {
119 } elsif ($item eq "\"") {
137 push @struclist, $dataitem;
143 push @struclist, $dataitem;
157 push @struclist, $dataitem;
166 if($item =~ /^\s*$/) {
169 if(ref $dataitem eq 'ARRAY') {
170 push @struclist, $dataitem;
175 push @struclist, $dataitem;
190 foreach $item (@{$data}) {
191 if($item =~ /^\/\*/) {
193 $item =~ s/\n/\n$indent/g;
194 if($out =~ /\n\s*$/s) {
195 $out .= $item."\n".$indent;
197 $out .= "\n".$indent.$item."\n".$indent;
205 #Pre-processor directive
206 if($out =~ /\n\s*$/s) {
207 $out =~ s/\n\s*$/\n/;
208 $out .= $item."\n".$indent;
210 $out .= "\n".$item."\n".$indent;
223 if(!$prevpreproc && !$prevcomment) {
232 $currline .= $indent;
240 if (ref $item eq 'ARRAY') {
242 $out .= displayData("$indent ", $depth+1, $item);
244 $out .= "{\n".displayData("$indent ", $depth+1, $item)."\n".$indent."}";
245 $currline = $indent."}";
248 if(length $currline.$item > 79) {
261 # Strip any trailing whitespace
262 $out =~ s/\s+\n/\n/g;