Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alvarez, Gonzalo
PsimagLite
Commits
3d5b4c78
Commit
3d5b4c78
authored
Oct 04, 2020
by
Alvarez, Gonzalo
Browse files
doc: PSIDOC_CONTINUE and PSIDOC_RESUME
parent
2eaf9fa5
Changes
4
Hide whitespace changes
Inline
Side-by-side
doc/Makefile
View file @
3d5b4c78
...
...
@@ -4,11 +4,11 @@ CXX = g++
all
:
manual.pdf tutorial.pdf
manual.tex
:
manual.ptex
manual.tex
:
manual.ptex
../scripts/doc.pl
find ../src
-iname
"*.h"
-or
-iname
"*.cpp"
|
\
perl ../scripts/doc.pl manual.ptex
tutorial.tex
:
tutorial.ptex ../src/*h ../drivers/*cpp
tutorial.tex
:
tutorial.ptex ../src/*h ../drivers/*cpp
../scripts/doc.pl
find ../src ../drivers
-iname
"*.h"
-or
-iname
"*.cpp"
|
\
perl ../scripts/doc.pl tutorial.ptex
...
...
doc/tutorial.ptex
View file @
3d5b4c78
...
...
@@ -118,7 +118,6 @@ 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
}
\ptexPaste
{
InputNg
_
MyInputCheck
}
\ptexPaste
{
InputNg
_
main1
}
\ptexPaste
{
InputNg
_
main2
}
\ptexPaste
{
InputNg
_
main3
}
...
...
drivers/testInputNg.cpp
View file @
3d5b4c78
...
...
@@ -28,13 +28,13 @@ First, note that we need two includes from PsimagLite.
PsimagLite files are usually under src, but in some
cases subdirectories are used. Here are the includes.
\begin{lstlisting}
PSIDOC_C
APTUR
E
PSIDOC_C
ONTINU
E
*/
#include
"InputNg.h"
#include
"InputCheckBase.h"
/* PSIDOC
InputNg_MyInputCheck
/* PSIDOC
_RESUME
\end{lstlisting}
InputNg has an option to check the inputs, so that
you can define the labels that you expect to find
...
...
scripts/doc.pl
View file @
3d5b4c78
...
...
@@ -26,6 +26,16 @@ recursiveExpand(\%labels);
replaceLabels
(
$file
,
\
%labels
);
printLabels
(
\
%labels
);
sub
printLabels
{
my
(
$labels
)
=
@_
;
foreach
my
$key
(
keys
%$labels
)
{
print
"
$key
\n
";
}
}
sub
loadLines
{
my
(
$lines
)
=
@_
;
...
...
@@ -112,12 +122,19 @@ sub loadLabels
my
$inCodeBlock
=
0
;
my
$codeBuffer
=
"";
my
$modifyLater
=
1
;
my
$hasContinue
=
0
;
for
(
my
$i
=
0
;
$i
<
$nlines
;
++
$i
)
{
$_
=
$lines
->
[
$i
];
if
(
/\/\* *PSIDOC_RESUME */
)
{
$hasContinue
=
0
;
next
;
}
if
(
/\/\* *PSIDOC +(.+$)/
)
{
my
$rest
=
$
1
;
chomp
(
$rest
);
checkThatItDoesNotHaveContinue
(
$hasContinue
,
"
PSIDOC
$rest
");
(
$label
,
$additional
)
=
procPsidocName
(
$rest
);
$modifyLater
=
1
;
...
...
@@ -132,6 +149,7 @@ sub loadLabels
if
(
/\/\* PSIDOC_CODE_START +(.+$)/
)
{
my
$rest
=
$
1
;
chomp
(
$rest
);
checkThatItDoesNotHaveContinue
(
$hasContinue
,
"
PSIDOC_CODE_START
$rest
");
$rest
=~
s/\*\/ *$//
;
if
(
$inCodeBlock
)
{
die
"
$0: Nested code blocks not allowed
\n
";
...
...
@@ -146,11 +164,13 @@ sub loadLabels
die
"
$0: ERROR: Label
$label
is duplicate
\n
";
}
print
STDERR
"
Opening
$label
\n
";
$inCodeBlock
=
1
;
next
;
}
if
(
/\/\* PSIDOC_CODE_END \*\//
)
{
print
STDERR
"
Closing
$label
\n
";
if
(
!
$inCodeBlock
)
{
die
"
$0: Closing code block while none is open
\n
";
}
...
...
@@ -162,6 +182,7 @@ sub loadLabels
}
if
(
/\*\//
)
{
next
if
(
$hasContinue
);
if
(
$label
ne
"
!DISABLED
"
and
$modifyLater
)
{
my
$inlabel
=
$label
.
"
::
";
$buffer
=~
s/PSIDOCCOPY \$/PSIDOCCOPY ${inlabel}/g
;
...
...
@@ -187,6 +208,7 @@ sub loadLabels
}
$buffer
=
"";
print
STDERR
"
Changing
$label
to !DISABLED
\n
";
$label
=
"
!DISABLED
";
$modifyLater
=
1
;
$additional
=
"";
...
...
@@ -195,6 +217,11 @@ sub loadLabels
next
;
}
if
(
/^[ \t]*PSIDOC_CONTINUE *$/
)
{
$hasContinue
=
1
;
next
;
}
if
(
$label
ne
"
!DISABLED
")
{
$buffer
.=
$_
.
"
\n
";
}
...
...
@@ -210,6 +237,13 @@ sub loadLabels
%$a
=
%labels
;
}
sub
checkThatItDoesNotHaveContinue
{
my
(
$hasContinue
,
$txt
)
=
@_
;
return
if
(
$hasContinue
==
0
);
die
"
$0: Cannot use
$txt
when has continue
\n
";
}
sub
procPsidocName
{
my
(
$nameLike
)
=
@_
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment