Commit 6309d541 authored by Alvarez, Gonzalo's avatar Alvarez, Gonzalo
Browse files

doc.pl for code sections

parent d204be72
......@@ -117,7 +117,9 @@ again the example should be able to compile without it; it won't run
though, but display a message saying that the GSL is needed.
\ptexPaste{InputNg_Intro}
\begin{lstlisting}
\ptexPaste{InputNg_Includes}
\end{lstlisting}
\end{document}
......@@ -29,10 +29,10 @@ PsimagLite files are usually under src, but in some
cases subdirectories are used. Here are the includes.
*/
/* PSIDOC_CODE_START InputNg_Includes */
/* PSIDOC_CODE_START InputNg_Includes nocapture */
#include "InputNg.h"
#include "InputCheckBase.h"
/* PSICODE_CODE_END */
/* PSIDOC_CODE_END */
class MyInputCheck : public PsimagLite::InputCheckBase {
......
......@@ -111,6 +111,7 @@ sub loadLabels
my $nlines = scalar(@$lines);
my $inCodeBlock = 0;
my $codeBuffer = "";
my $capture = 1;
for (my $i = 0; $i < $nlines; ++$i) {
$_ = $lines->[$i];
......@@ -118,6 +119,8 @@ sub loadLabels
my $rest = $1;
chomp($rest);
($label, $additional) = procPsidocName($rest);
$capture = 1;
my $txt = $labels{"$label"};
if (defined($txt)) {
die "$0: ERROR: Label $label is duplicate\n";
......@@ -136,7 +139,8 @@ sub loadLabels
($label, $additional) = procPsidocName($rest);
$label =~ s/ //g;
print STDERR "ADDING *$label* \n";
$capture = ($additional eq "nocapture") ? 0 : 1;
my $txt = $labels{"$label"};
if (defined($txt)) {
die "$0: ERROR: Label $label is duplicate\n";
......@@ -151,14 +155,14 @@ sub loadLabels
die "$0: Closing code block while none is open\n";
}
$labels{"$label"} = $codeBuffer;
$labels{"$label"} = [$codeBuffer];
$codeBuffer = "";
$inCodeBlock = 0;
next;
}
if (/\*\//) {
if ($label ne "!DISABLED") {
if ($label ne "!DISABLED" and $capture) {
my $inlabel = $label."::";
$buffer =~ s/PSIDOCCOPY \$/PSIDOCCOPY ${inlabel}/g;
my @temp = ($buffer);
......@@ -184,6 +188,7 @@ sub loadLabels
$buffer = "";
$label = "!DISABLED";
$capture = 1;
$additional = "";
} elsif ($inCodeBlock) {
$codeBuffer .= $_."\n";
......@@ -195,6 +200,10 @@ sub loadLabels
}
}
if ($inCodeBlock) {
die "$0: Code block was not closed for label $label\n";
}
my $n = scalar(%labels);
print STDERR "$0: $n labels found\n";
......@@ -261,7 +270,7 @@ sub captureFirstFunctionBelow
last if ($line =~ /\/\*/);
next if ($line =~ /^ *\/\//);
$buffer .= "$line\n";
$markContent .= "$line\n" if ($markName ne "");
my $plus = () = $line =~ /\{/g;
my $minus = () = $line =~ /\}/g;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment