From 2d7356d29a85e8493acb91d1f2fbc5194c4f4677 Mon Sep 17 00:00:00 2001 From: Jonas Fonseca Date: Mon, 9 Jan 2006 00:53:41 +0100 Subject: [PATCH] Improve support for struct documentation by saving the struct name This makes it easy to create id:[$struct$member]:: One line description --- doc/tools/code2doc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/tools/code2doc b/doc/tools/code2doc index 3adb53d7f..d6b03202b 100755 --- a/doc/tools/code2doc +++ b/doc/tools/code2doc @@ -7,9 +7,10 @@ print "Usage: $0 [FILE]\n\tParses [FILE], outputing the result to stdout.\n" and exit if not @ARGV; my ($input) = @ARGV; -my ($found, $start, $first, $gotone); +my ($found, $start, $first, $gotone, $idpath); print "CopyleftŠ 2006, Russ Rowan (See `COPYING')\n" and exit if $input eq '-v'; open FILEIN, "<$input" or print "File `$input' was not found.\n" and exit; +$idpath = ''; while () { if ($found) @@ -24,6 +25,7 @@ while () $_ = $1; $first = 1; print STDOUT "\n\n" if $start; if ($_ =~ s/\s*\*\/$//) { $found = 'sorta'; } else { $found = $.; } + if ($_ =~ /struct:[[]([^\]]+)[\]]/) { $idpath = "$1."; } else { $idpath = ''; } if ($_ =~ /::/) { $_ = "$_\n\n"; } else { @@ -31,10 +33,10 @@ while () $_ = "$_\n$dash\n\n"; } } - elsif ($_ =~ /\s*([A-Z0-9_]+)(\s+=\s+[0-9]+)?,\s*\/\*::\s*(.*)\s+\*\/$/) + elsif ($_ =~ /^(\s|[^\s=]+)*[\s*]([A-Za-z0-9_]+)(\s+=\s+[^,;]+)?[,;]\s*\/\*::\s*(.*)\s+\*\/$/) { print STDOUT "\n" if $gotone; - $_ =~ s/\s*([A-Z0-9_]+)(\s+=\s+[0-9]+|),\s*\/\*::\s*(.*)\s+\*\/$/id:[$1]::\n\t$3/; + $_ = "\nid:[$idpath$2]::\n\t$4\n"; $found = 'sorta'; $gotone = $.; } print STDOUT "\n" and $gotone = undef if $gotone and $gotone < $.;